VC2008中爲你的程序添加XP主題風格

  在Windows XP中提供了更美觀的主題風格,但是VC中添加的控件等卻還是經典風格,下面的方法可讓你的程序實現XP的主題風格。

 

1.插入資源,選擇“自定義”,輸入“24”(不帶雙引號)作爲資源類型。

2.拷貝下面的代碼到編輯框中。

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<assembly 
   xmlns="urn:schemas-microsoft-com:asm.v1" 
   manifestVersion="1.0">
 <assemblyIdentity 
    processorArchitecture="x86" 
    version="5.1.0.0"
    type="win32"
    name="test.exe"/>
 <description>Test Application</description>
 <dependency>
  <dependentAssembly>
    <assemblyIdentity
         type="win32"
         name="Microsoft.Windows.Common-Controls"
         version="6.0.0.0"
         publicKeyToken="6595b64144ccf1df"
         language="*"
         processorArchitecture="x86"/>
  </dependentAssembly>
 </dependency>
</assembly>
說明:要將 name字段的"test.exe"改爲你應用程序的名稱,如果是動態庫就改爲動態庫的名稱,將 "Test Application"改爲你想要的描述文本
3.將資源ID改爲1(如果是動態庫就改爲2).
4.在你程序的InitInstance()(或者WinMain())中添加InitCommonControls(),記住在工程中包含commctrl.h 和連接庫 comctl32.lib。
5.
VC2008中 項目->工程屬性->配置屬性->清單工具->輸入和輸出->嵌入清單 選擇 否.
6.重新生成。
7.在Windows XP中運行你的程序,就會自動應用XP主題風格了。
參考:http://www.codeproject.com/KB/winsdk/xptheme.aspx
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章