使用C ++ Win32 API启用视觉样式吗? [英] Enabling visual styles with C++ Win32 API?
问题描述
根据MSDN文章,默认情况下,视觉样式应该应用于Win32应用程序.但是,在我将其插入标头之前,UI元素都显示为Windows Classic:
According to the MSDN article, visual styles are supposed to be applied to Win32 applications by default. However, the UI elements all appeared as Windows Classic until I inserted this into my header:
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
现在,当我尝试使用此调用添加按钮时:
Now, when I try to add a button using this call:
CreateWindow(L"button", L"Quit",
WS_VISIBLE | WS_CHILD,
120, 50, 80, 25,
hWnd, NULL, hInst, NULL);
结果如下:
这看起来像是Windows 8带有Windows Classic字体的按钮.我是否缺少适用于Windows 8完整视觉样式的内容?
That looks like a Windows 8 button with Windows Classic font. Am I missing something to apply the full Windows 8 visual style?
推荐答案
该按钮已设置为主题,但是您没有为该按钮设置字体.因此,您的按钮具有默认字体.
The button is themed, but you did not set a font for the button. Because of that, your button has the default font.
这篇关于使用C ++ Win32 API启用视觉样式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!