绘制问题 Windows 10 个标题按钮
Problems drawing Windows 10 Caption Buttons
我在使用 VisualStyleRenderer class.
绘制 Windows 10 个主题 Window 标题按钮时遇到问题
我的问题是我不知道要使用哪个主题 Class。
我尝试了 Window
和 CompositedWindow::Window
,但是,其中 none 实际上包含 Windows 10 个主题按钮,因为我发现使用 this msstyle editor.
哪个主题 Class 包含 Windows 10 个主题标题按钮?
现在的样子:
我希望它看起来如何:
我是如何绘制按钮的:
protected override void OnPaint(PaintEventArgs e)
{
VisualStyleRenderer renderer = new VisualStyleRenderer("Window", 18 /*WP_CLOSEBUTTON*/, 1 /*CBS_NORMAL*/);
var size = renderer.GetPartSize(e.Graphics, ThemeSizeType.True);
renderer.DrawBackground(e.Graphics, new System.Drawing.Rectangle(10, 10, size.Width, size.Height));
}
问题出在您使用的 Window
class 上。这是在没有合成引擎的情况下合成的遗留 GDI Window。
DWM
桌面 Window 管理器合成每个 window,因为每个 window 只是一个 DirectX 表面。您需要使用 DWMWindow
class 而不是 aero.msstyles
.
中的 Window
class
注意每个 DPI 有多个字形:96、120、144 等。
我在使用 VisualStyleRenderer class.
绘制 Windows 10 个主题 Window 标题按钮时遇到问题我的问题是我不知道要使用哪个主题 Class。
我尝试了 Window
和 CompositedWindow::Window
,但是,其中 none 实际上包含 Windows 10 个主题按钮,因为我发现使用 this msstyle editor.
哪个主题 Class 包含 Windows 10 个主题标题按钮?
现在的样子:
我希望它看起来如何:
我是如何绘制按钮的:
protected override void OnPaint(PaintEventArgs e)
{
VisualStyleRenderer renderer = new VisualStyleRenderer("Window", 18 /*WP_CLOSEBUTTON*/, 1 /*CBS_NORMAL*/);
var size = renderer.GetPartSize(e.Graphics, ThemeSizeType.True);
renderer.DrawBackground(e.Graphics, new System.Drawing.Rectangle(10, 10, size.Width, size.Height));
}
问题出在您使用的 Window
class 上。这是在没有合成引擎的情况下合成的遗留 GDI Window。
DWM
桌面 Window 管理器合成每个 window,因为每个 window 只是一个 DirectX 表面。您需要使用 DWMWindow
class 而不是 aero.msstyles
.
Window
class
注意每个 DPI 有多个字形:96、120、144 等。