如何检索窗口的最小化,最大化和closuresbutton的大小?

如何检索窗口的最小化,最大化和closuresbutton的大小?,第1张

概述如何检索窗口的最小化最大化和closuresbutton的大小

到目前为止,我尝试使用GetthemePartSize,GetthemeMetric,GetSystemMetrics,WM_GETTitlebarINFOEX通过SendMessage和几个其他调用,但没有什么甚至接近真正的维度(启用主题的windows 7)。

基本上我的问题是:如何获得这些button的大小(和位置,理想情况下,甚至处理),GetthemePartSize检索到的值甚至意味着什么? 他们有什么好处?

我已经看了这个答案和其他许多人,但他们根本不工作。

谢谢

可靠地检测到我的另一个应用程序正在运行

httpWebResponse原始响应,使用reflection

如何在C#GUI窗体中运行batch file

windows SDK安装失败

windows CE 5.0 httpD < – > .NET应用程序

更新

汉斯:

[Dllimport("uxtheme",ExactSpelling=true)] private extern static Int32 GetthemePartSize(IntPtr htheme,IntPtr hdc,WindowPart part,WindowPartState state,ref RECT pRect,themeSize eSize,out SIZE size); [StructLayout(LayoutKind.Sequential)] private struct RECT { public int left; public int top; public int right; public int bottom; } [StructLayout(LayoutKind.Sequential)] private struct SIZE { public int cx; public int cy; } private const int TS_TRUE = 1; private const int CBS_norMAL = 1; private const int WP_CLOSEbutton = 18; private const string VSCLASS_WINDOW = "WINDOW"; /* insIDe a method */ var rect = new RECT {left = 0,right = 200,top = 0,bottom = 200}; var size = new SIZE(); var windowHandle = new WindowInteropHelper({MyWindow}).Handle; var theme = OpenthemeData(windowHandle,VSCLASS_WINDOW); GetthemePartSize(theme,null,WP_CLOSEbutton,CBS_norMAL,ref rect,TS_TRUE,ref size); // result on w7 with default theme -> size.cx == 28,size.cy == 17

强烈地指出三个相互引用的程序集

假设registry荨麻疹总是一样的,这有多安全?

我们可以从共享path运行batch file(.bat)吗?

计算目录大小

如何在特殊的PowerShell链命令4命令提示符?

在浏览firefox 17.0.1源代码(即文件nsNativethemeWin.cpp和nsUXthemeData.cpp)之后,我能够为在Vista或更新版本上运行的桌面应用提供部分解决方案,以满足我的需求:

private const int DWMWA_CAPTION_button_BOUNDS = 5; [StructLayout(LayoutKind.Sequential)] public struct RECT { public int left; public int top; public int right; public int bottom; } [Dllimport("DWmAPI.dll")] public static extern int DWmGetwindowAttribute(IntPtr hwnd,int DWAttribute,out RECT pvAttribute,int cbAttribute); var windowHandle = new WindowInteropHelper(Main.Instance).Handle; var buttonsRect = new RECT(); var sizebuttonsRect = Marshal.SizeOf(buttonsRect); DWmGetwindowAttribute(windowHandle,DWMWA_CAPTION_button_BOUNDS,out buttonsRect,sizebuttonsRect);

存储在buttonsRect中的结果有些奇怪:宽度差异(右 – 左== 105)恰好符合实际边界,但高度差(29px)比按钮实际占用的区域大8个像素。

由于这个问题没有完全回答任何问题,所以我将把这个问题留给进一步的答复。

再次感谢汉斯的宝贵和深思熟虑的评论。 正如您可以清楚地看到的,这完全是关于编程语言和代码片段的。

您可以将Microsoft.windows.Shell.dll与自定义镶边窗口库结合使用来修改或寻址窗口按钮。 我正在使用这个为了创建windows 8 UI风格的应用程序

http://www.codeproject.com/Articles/131515/WPF-Custom-Chrome-library

http://archive.msdn.microsoft.com/WPFShell

总结

以上是内存溢出为你收集整理的如何检索窗口的最小化,最大化和closuresbutton的大小?全部内容,希望文章能够帮你解决如何检索窗口的最小化,最大化和closuresbutton的大小?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1292842.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-10
下一篇2022-06-10

发表评论

登录后才能评论

评论列表(0条)

    保存