VC++中启用XP主题外观

来源:互联网 发布:淘宝手机端首页红包 编辑:程序博客网 时间:2024/05/15 11:15

.NET Winform中,启用XP主题外观执行以下语句即可:

Application.EnableVisualStyles();

VC Win32项目,默认是不启用XP主题外观的,并不是每个人都喜欢简洁的Windows经典主题外观。
启用XP主题外观,需要用资源文件。有种更简单的方式:
头文件里加入以下语句:
#include <CommCtrl.h> 
#pragma comment(lib, "ComCtl32.Lib") 
#pragma comment(linker, "/manifestdependency:/"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'/"") 

在main函数最前面调用InitCommonControls函数:
int APIENTRY _tWinMain(HINSTANCE hInstance, 
                     HINSTANCE hPrevInstance, 
                     LPTSTR    lpCmdLine, 
                     
int       nCmdShow) 

    InitCommonControls(); 
    MessageBox(NULL, L
"Windows XP theme was enabled.", L"http://www.xianfen.net"0 ); 
    
return 0
}

运行程序已经启用了XP主题外观,如图:

http://www.cnblogs.com/zxjay/archive/2009/06/17/1505255.html

原创粉丝点击