如何获取窗口标题按钮的大小和位置(最小化、恢复、关闭)

2022-01-12 00:00:00 winapi windows-vista c++ mfc uxtheme

是否有 API 调用来确定窗口标题按钮的大小和位置?我正在尝试将 vista 样式的标题按钮绘制到所有者绘制的窗口上.我正在处理 c/c++/mfc.

有人有绘制关闭按钮的代码示例吗?

解决方案

我找到了获取vista中按钮位置所需的函数:

Is there an API call to determine the size and position of window caption buttons? I'm trying to draw vista-style caption buttons onto an owner drawn window. I'm dealing with c/c++/mfc.

Edit: Does anyone have a code example to draw the close button?

解决方案

I've found the function required to get the position of the buttons in vista: WM_GETTITLEBARINFOEX

This link also shows the system metrics required to get all the spacing correct (shame it's not a full dialog picture though). This works perfectly in Vista, and mostly in XP (in XP there is slightly too much of a gap between the buttons).

相关文章