[英]Location of a maximized window with custom chrome
I've created a window with a custom chrome by: 我通过以下方式创建了一个带有自定义镶边的窗口:
WM_NCHITTEST
and returning the appropriate values for the window caption and borders, WM_NCHITTEST
并返回窗口标题和边框的适当值, WM_NCPAINT
(and WM_NCUAHDRAWCAPTION
, WM_NCUAHDRAWFRAME
), WM_NCPAINT
(和WM_NCUAHDRAWCAPTION
, WM_NCUAHDRAWFRAME
), WM_SETTEXT
, WM_SETICON
and WM_NCACTIVATE
with DefWindowProc
by temporarily removing WM_VISIBLE
, WM_SETTEXT
, WM_SETICON
和WM_NCACTIVATE
与DefWindowProc
通过暂时删除WM_VISIBLE
, WM_WINDOWPOSCHANGED
to apply a window region for rounded corners. WM_WINDOWPOSCHANGED
以将窗口区域应用于圆角。 Moving/Resizing is handled fine by Windows. Windows可以很好地处理移动/调整大小。 I added
WS_THICKFRAME
to the window styles to enable Aero Snap functionality. 我在窗口样式中添加了
WS_THICKFRAME
以启用Aero Snap功能。 But now when the window is maximized it is positioned at (-5,-5)
and my custom titlebar is cut off (this doesn't happen without WS_THICKFRAME
). 但是现在当窗口最大化时,它位于
(-5,-5)
并且我的自定义标题栏也被切断了(没有WS_THICKFRAME
不会发生)。
What is the proper way to fix that? 解决该问题的正确方法是什么? What influences that position?
什么因素影响该职位? It seems to be unrelated to values returned for
WM_NCHITTEST
. 它似乎与为
WM_NCHITTEST
返回的值无关。
Late answer, but it seems like noone else has answered. 答案较晚,但似乎没人回答。
You can check when the window is maximized and account for the margin when the window is maximized. 您可以检查窗口何时最大化,并在窗口最大化时考虑边距。 You may want to handle WM_NCCALCSIZE rather than WM_NCPAINT to make the entire window appear as client area, rather than painting the non-client area.
您可能要处理WM_NCCALCSIZE而不是WM_NCPAINT,以使整个窗口显示为客户区,而不是绘制非客户区。
This describes one approach to implementing custom chrome (I was the author): http://blogs.msdn.com/b/wpfsdk/archive/2008/09/08/custom-window-chrome-in-wpf.aspx 这描述了一种实现自定义chrome的方法(我是作者): http : //blogs.msdn.com/b/wpfsdk/archive/2008/09/08/custom-window-chrome-in-wpf.aspx
Hope that helps, 希望能有所帮助,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.