VC++6 實現介面使用XP風格

來源:互聯網
上載者:User
VC++6 實現介面使用XP風格

看到有人需要這個東西,在英文下有很多文章,中文搜尋發現不是很好,因此特意介紹下。

1.實現原理

  微軟為Windows
XP提供了Themes服務。Themes可以讓程式具有“XP風格”,看起來更美觀,因為微軟更新了Comctl32.dll(ver
6.0)這個“XP風格”的控制項。微軟還為了保留傳統的Windows介面風格,特地留下了Comctl32.dll v5.8。VC6的推出時間早於WinXP,因此VC6的程式預設是不使用“xp風格”的。

  程式使用xp風格主要是內建了manifest這東東。因此只要讓VC6的程式中包含即可。包含可以外置,也可以內建為資源。

2.實現方法:

  1.開啟你的VC6 工程,找到資源試圖(ResourceView),然後在視圖中的樹的根結點上點滑鼠右鍵,選擇菜單“插入(Insert)”。
 
  2.在彈出的“插入資源(Insert Resource)”對話方塊中選擇“Custom”,在新對話方塊(“New Custom Resource”)輸入框中輸入 24。 因為manifest的類型是24, 點擊“OK”按鈕。
 
  3.在資源檢視的樹上面選擇24下方的條目“DDR_DEFAULT1”上點右鍵,選擇“Properties”,將ID:修改為1.
 
  4.雙擊剛才修改的“1”條目,然後在右方的編輯器視窗中輸入下面的代碼:

  1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
  2. <assembly 
  3.    xmlns="urn:schemas-microsoft-com:asm.v1" 
  4.    manifestVersion="1.0">
  5.  <assemblyIdentity 
  6.     processorArchitecture="x86" 
  7.     version="5.1.0.0"
  8.     type="win32"
  9.     name="test.exe"/>
  10.  <description>Test Application</description>
  11.  <dependency>
  12.   <dependentAssembly>
  13.     <assemblyIdentity
  14.          type="win32"
  15.          name="Microsoft.Windows.Common-Controls"
  16.          version="6.0.0.0"
  17.          publicKeyToken="6595b64144ccf1df"
  18.          language="*"
  19.          processorArchitecture="x86"/>
  20.   </dependentAssembly>
  21.  </dependency>
  22. </assembly>

  
  5.儲存工程,重新編譯 

附,前後對比圖:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.