WPF 有SystemParameters class http://msdn.microsoft.com/en-us/library/system.windows.systemparameters.aspx公开了大量的系统指标。在我的计算机上,我注意到普通窗口的标题高 30 像素,边框宽 8 像素。这是在启用了 Aero 主题的 Windows 7 上:
然而,SystemParameters
返回以下值:
SystemParameters.BorderWidth = 5
SystemParameters.CaptionHeight = 21
这里我禁用了 Aero 主题:
Now, SystemParameters
返回以下值:
SystemParameters.BorderWidth = 1
SystemParameters.CaptionHeight = 18
如何使用计算实际观测值SystemParameters
?
对于可调整大小的窗口,您需要使用一组不同的参数来计算大小:
var titleHeight = SystemParameters.WindowCaptionHeight
+ SystemParameters.ResizeFrameHorizontalBorderHeight;
var verticalBorderWidth = SystemParameters.ResizeFrameVerticalBorderWidth;
当您修改主题时,这些大小将会改变。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)