How to change the control themes in a Win32 API application?

让人想犯罪 __ 提交于 2020-01-01 16:55:11

问题


If I create a button in the Win32 API, the default conrol theme looks like a Windows 95/98 button. I remember in the past the Microsoft forums told me how to get the XP style, but I don't recall how to do this. Is there a way to programatically or manually change the control themes in a Win32 application? Thanks.


回答1:


You want to Enable Visual Styles by adding a manifest dependency to the common control 6 assembly to your applications manifest.

If you use DevStudio it should be as simple as adding the #pragma directive from the linked page:

#pragma comment(linker,"\"/manifestdependency:type='win32'        
                name='Microsoft.Windows.Common-Controls'
                version='6.0.0.0' processorArchitecture='*'
                publicKeyToken='6595b64144ccf1df' language='*'\"")



回答2:


SetWindowTheme Function would appear to be the solution. HTH



来源:https://stackoverflow.com/questions/3524009/how-to-change-the-control-themes-in-a-win32-api-application

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