如何实现无标题边框 Aero 窗口?
我知道如何删除表单的边框,但我只想删除标题。谷歌搜索 P/Invokes 没有给我太多结果,所以我想知道,我怎样才能达到这样的结果?
I know how I can remove the border of my form, but I simply want to remove the caption. Googling for P/Invokes didn't give me much results, so I'm wondering, how can I achieve such a result?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自非托管开发,我会 P/Invoke {Get/Set}WindowLong 等 - 这是我最初的反应 - 但有一种托管方法可以处理这个问题。
您需要覆盖表单中的 CreateParams 属性,删除边框样式并添加粗框样式,如下所示:
建议阅读列表
窗口样式
http://msdn.microsoft.com/en- us/library/ms632600%28VS.85%29.aspx
Form::CreateParams 属性
http://msdn.microsoft.com/ en-us/library/system.windows.forms.form.createparams.aspx
Coming from unmanaged development, I'd P/Invoke {Get/Set}WindowLong, etc. etc. -- which was my initial response -- but there's a managed way to deal with this.
You'll want to override the CreateParams property in your form, removing the bordering style and adding the thick frame style, as such:
Suggested reading list
Window Styles
http://msdn.microsoft.com/en-us/library/ms632600%28VS.85%29.aspx
Form::CreateParams Property
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.createparams.aspx
我现在没有VS,所以无法给你确切的答案,抱歉。
在窗口的属性窗格中查找边框样式,其中之一将允许您设置类似的:)
编辑:
我知道我错过了一些东西......首先,查找属性“ControlBox”、“MaximizeBox”和“MinimizeBox”并将它们设置为 false 并选择“FormBorderStyle”属性中的相当大的选项之一 - 是的,它看起来不能像图片中的那个也是固定大小的,至少没有 PinVoke AFAIK-。
还要记住将“文本”属性留空。
希望这有帮助:)
I don't have VS right now so I can't give you an exact answer, sorry.
In the window's property pane look for border style, one of them will allow you to set one similar :)
Edit:
I knew I was missing something... First, look for the properties "ControlBox", "MaximizeBox" and "MinimizeBox" and set them to false and choose one of the sizable options in "FormBorderStyle" property -yes, it cannot look like the one in the pic and also be fixed-size, at least not without PinVoke AFAIK-.
Also remember to leave the "Text" property blank.
Hope this helps :)