gpt4 book ai didi

windows - 如何在 Windows 中获取窗口的默认标题栏高度?

转载 作者:可可西里 更新时间:2023-11-01 09:47:39 25 4
gpt4 key购买 nike

我正在开发一个使用自绘标题栏的应用程序,它需要模仿系统默认的标题栏。

那么在 Windows 中如何获取重叠窗口的默认标题栏高度?

最佳答案

从 Firefox 移植的源代码:

// mCaptionHeight is the default size of the NC area at
// the top of the window. If the window has a caption,
// the size is calculated as the sum of:
// SM_CYFRAME - The thickness of the sizing border
// around a resizable window
// SM_CXPADDEDBORDER - The amount of border padding
// for captioned windows
// SM_CYCAPTION - The height of the caption area
//
// If the window does not have a caption, mCaptionHeight will be equal to
// `GetSystemMetrics(SM_CYFRAME)`
int height = (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYCAPTION) +
GetSystemMetrics(SM_CXPADDEDBORDER));
return height;

PS:高度与 dpi 相关。

关于windows - 如何在 Windows 中获取窗口的默认标题栏高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28524463/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com