首页 > 解决方案 > 在win32中更改无边框窗口的颜色

问题描述

我正在创建一个无边框窗口,类似于https://github.com/melak47/BorderlessWindow并使用它来创建交换链并使用 vulkan 绘制到其中。

为了获得无边框窗口(带有航空阴影),我使用: DwmExtendFrameIntoClientArea 最多 1 个像素。我可以用我的交换链在最后一个像素边框上绘制。经过一番谷歌搜索后,我明白这是唯一的方法。

不幸的是,在调整大小时,无论我如何与合成器同步,我仍然偶尔会看到明亮的白色边框闪烁。

为了使这一点可以接受,我想为边框使用更中性的颜色。我如何实现这一目标?

编辑:如果我将边框增加到 10 像素,我会得到:( 在此处输入图像描述 绿色和红色框由 vulkan 绘制,没有透明度,框架被清除为零的 alpha)

这个白色是哪里来的?

注意:这不是强调色。

标签: windowswin32gui

解决方案


I found the solution.

There is an undocumented function to set additional DWM settings of a window: https://gist.github.com/ysc3839/b08d2bff1c7dacde529bed1d37e85ccf

This is also used to make blurred transparency and can change the border color with the ACCENT_ENABLE_GRADIENT enum.


推荐阅读