Open Gaoyifei1011 opened 2 months ago
@Gaoyifei1011
Why not set Form.ControlBox = False Form.Text = ""
You can also get rid of boarder with
Form.BoarderStyle = None
@Gaoyifei1011
Why not set Form.ControlBox = False Form.Text = ""
You can also get rid of boarder with
Form.BoarderStyle = None
This method seems simple and crude, but it does not restore all the characteristics of the window. For example, the window size can be adjusted, the window right-click menu is displayed, and the window non-customer area is displayed 这种方法看起来简单粗暴,但是却不能很好的还原窗口的所有特性。比如可调整窗口大小,显示窗口右键菜单,窗口非客户区等等
You can also set the FormBorderStyle property of the form to FixedDialog
, FixedSingle
, or Fixed3D
that will prevent resizing.
And if you don't want context menu you can write your own empty handler.
Since I am not sure what issue you are exactly trying to solve I can't be of more help. If you need this functionality a lot you can create a custom control with these options preset and not exposed.
You can also set the FormBorderStyle property of the form to
FixedDialog
,FixedSingle
, orFixed3D
that will prevent resizing.And if you don't want context menu you can write your own empty handler.
Since I am not sure what issue you are exactly trying to solve I can't be of more help. If you need this functionality a lot you can create a custom control with these options preset and not exposed.
然而,当指定 formborderstyle 为您上述的这三种类型时,并不能够很好的隐藏默认的标题栏,如果指定none时,虽然可以隐藏默认的标题栏,但是窗口其他行为也随之发生了变化 However, when formborderstyle is specified as one of your three types above, the default title bar is not well hidden. If none is specified, the default title bar is hidden, but the other behavior of the window changes as well
You can try to download the latest wpf gallery preview in the Microsoft store to see the window style you want to see how the latest wpf hides the default title bar 您可以尝试在Microsoft store 下载最新的 wpf gallery preview,可以查看想应的窗口样式,了解最新的 wpf 是怎么隐藏默认的标题栏
wpf gallery preview download link https://apps.microsoft.com/detail/9ndlx60wx4kq?hl=en-US&gl=US
Microsoft 在 Winui3 和 uwp 中提出的标题栏自定义,您可以了解一下 https://learn.microsoft.com/zh-cn/windows/apps/develop/title-bar
效果图
WinUI 3 With default titlebar
WinUI 3 with custom titlebar
@KlausLoeffelmann can you talk to this?
Background and motivation
Hope to provide the ability to customize the title bar 希望能提供自定义标题栏的功能
Currently in uwp or winui 3, all the corresponding window class contains a extendscontentintotitlebar properties, can be hidden by default title bar, and a custom title bar, want to ask winform will consider such function? If not, there is no corresponding win32 api to implement such functionality 目前在 uwp 或 winui 3 中,都在对应的 window 类中包含一个 extendscontentintotitlebar 的属性,可以隐藏默认的标题栏,并自定义标题栏,想问一下 winform 以后会考虑这样的功能吗?如果没有,有没有相应的 win32 api来实现这样的功能?
reference link:https://learn.microsoft.com/zh-cn/windows/apps/develop/title-bar
API Proposal
API Usage
NONE
Alternative Designs
NONE
Risks
NONE
Will this feature affect UI controls?
Yes