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='*'\"")
#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 主题开启. " , L " Windows XP 主题 " , 0 );
return 0 ;
}
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
InitCommonControls();
MessageBox(NULL, L " Windows XP 主题开启. " , L " Windows XP 主题 " , 0 );
return 0 ;
}