Enabling visual styles with C++ Win32 API?

ⅰ亾dé卋堺 提交于 2020-12-26 07:15:28

问题


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);

The result looks like this:

enter image description here

That looks like a Windows 8 button with Windows Classic font. Am I missing something to apply the full Windows 8 visual style?


回答1:


The button is themed, but you did not set a font for the button. Because of that, your button has the default font.



来源:https://stackoverflow.com/questions/29321090/enabling-visual-styles-with-c-win32-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!