gpt4 book ai didi

windows - 如何获得窗框的颜色?

转载 作者:可可西里 更新时间:2023-11-01 10:25:38 24 4
gpt4 key购买 nike

我正在尝试读取常规窗口的窗口边框(框架)的颜色。

似乎 window->palette().color(QPalette::XXXX) 可以做到,但是 XXXX 是什么?还是调色板不可能?如果是,怎么办?

最佳答案

你需要使用原生的GetSysColorBrush功能:

QColor getWindowFrameColor() {
// This is the only way to detect that a given color is supported
HBRUSH brush = GetSysColorBrush(COLOR_ACTIVEBORDER);
if (brush) {
DWORD color = GetSysColor(COLOR_ACTIVEBORDER);
return QColor(GetRValue(color), GetGValue(color), GetBValue(color));
// calling DeleteObject(brush) is unnecessary, but would be harmless
}
return QColor();
}

我已经在 Qt 源代码中搜索了 COLOR_ACTIVEBORDER,检索它的唯一其他方法是在 WebKit 上运行一些自定义 javascript 代码。

关于windows - 如何获得窗框的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19366479/

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