问题描述
||
我正在将VS6 MFC对话框应用程序更新为VS2008。更新代码很容易,但是对话框仍然具有老式的VS6外观。例如,组框的边缘为正方形,为深灰色。而不是VS2008应用程序组框的圆角和浅灰色。
如何强制我的应用程序使用VS2008 MFC对话框应用程序的更现代外观?
解决方法
一个新的MFC项目将在stdafx.h中添加以下内容:
// Define manifest directives to match platform
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,\"/manifestdependency:\\\"type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' processorArchitecture=\'x86\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\'\\\"\")
#elif defined _M_X64
#pragma comment(linker,\"/manifestdependency:\\\"type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' processorArchitecture=\'amd64\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\'\\\"\")
#else
#pragma comment(linker,\"/manifestdependency:\\\"type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' processorArchitecture=\'*\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\'\\\"\")
#endif
#endif
我还将以下内容添加到我的项目中,以明确链接到UXTHEME.LIB,该子类将基本控件子类化以添加主题支持:
#ifdef _UXTHEME_H_
#pragma message( \"Including uxtheme.lib for linking\" )
#pragma comment(lib,\"uxtheme.lib\")
#endif