線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2148
推到 Plurk!
推到 Facebook!

不用任何控制項作出XP風格的程式

 
ddy
站務副站長


發表:262
回覆:2105
積分:1169
註冊:2002-07-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-12-04 00:58:17 IP:61.59.xxx.xxx 未訂閱
XP 風格是現在很流行的風格界面,你是否發現自己以BCB 6(含) /Delphi 6(含)以下的所開發的程式,在XP上執行無法顯示xp 風格    要在自己的程式中實現Windows XP的視覺效果,就要給程式增加一個說明文件。這個說明文件可以是程式的資源檔案,也可以是同路徑下的文件。     這個說明文件是一個XML文件。它讓Windows XP在鏈結資料時決定使用哪種版本的comctl32.dll。 這個XML文件含有你編寫的程式的資訊和使用的comctrl32.dll版本資訊。    僅參考下列網站,整理如下 http://www.codeproject.com/csharp/dotnetvisualstyles.asp http://www.cx66.com/cxgzs/program/delphi/910.htm (1) 建立一個叫themed.manifest的文字檔案
< ?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 < assembly  manifestVersion="1.0">
 < assemblyIdentity    
        name="Your.Application.Name.Here"    ------應用程式的名稱
        processorArchitecture="x86"    
        version="1.0.0.0"    
        type="win32"/> 
< description> WindowsXP Shell< /description> 
< dependency>
     < dependentAssembly>
         < assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="x86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
     < /dependentAssembly>
 < /dependency>
 < /assembly> 
(2) 將文中description標記的內容和assemblyIdentity標記的"name"改寫成你的應用稱式的名稱。然後將文件存檔。 (3) 創建一個資源檔案來指向上面的文件,資源檔案名爲 例:XPStyle.RC 內容如下:1 24 "themed.manifest" (4) 現在要用Delphi的資源編譯器(brcc32.exe)來編譯XPStyle.rc。 在命令行鍵入指令: brcc32 XPStyle.rc 編譯之後生成XPStyle.res文件。 (5) 在應用程式中包含這個資源檔案,並在{$R *.DFM}之後注明{$R XPStyle.res}。 (6) 編譯程式並運行。 (7) 測試程式是否正常。 注意,有些元件,如TGroupBox, TSpeedButton等不支援XP模式。 如果使用TListView元件,請閱讀《TListView在XP中的補丁程式》 大家試試看吧~~~ --【KTop SNG新聞現場】--記者:ddy----------------------------------------- 請各位市民做好資源回收與垃圾分類,讓不良標題與不當發言在KTop 市消失 ------------------------------------------------------------------------- 發表人 - ddy 於 2002/12/04 10:03:54
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-12-04 09:16:51 IP:61.218.xxx.xxx 未訂閱
這是從MSXML v4.0 Help中截取的內容,給大家參考參考 ============================================= Microsoft XML Core Services (MSXML) 4.0      Creating a Manifest for Your Application To deploy applications that use MSXML 4.0 to computers running Windows XP, you must create an application manifest and deploy it with your application.    To create a manifest for your application 
    Copy this sample manifest and paste it into any text editor. 
< ?xml version="1.0" encoding="UTF-8" standalone="yes"? >
< assembly  manifestVersion="1.0" >
< assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="X86"
    name="Microsoft.Windows.mysampleApp"
    type="win32"
/ >
< description >Your app description here< /description >
< dependency >
    < dependentAssembly >
        < assemblyIdentity
            type="win32"
            name="Microsoft.MSXML2"
            version="4.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="4495b64144ccf1df"
            language="*"
        / >
    < /dependentAssembly >
< /dependency >
< /assembly >
After you have pasted the sample code above, you must update it as appropriate for your application. To do this, change the featured values (those in bold in the sample code) of the first element as follows: For the version attribute, set the value to the current version number for your component or application. This number is specified in the properties for your project when it is built using Microsoft® Visual Studio. For the processorArchitecture attribute, only change the value of the processor architecture if you are deploying to a processor architecture that is not Intel-x86 compatible. Otherwise, use the suggested default. For the name attribute, set the value to the registered name for your application. For most Windows applications, you only need to replace "mysampleapp" with the base name of the executable (.exe) file containing your application. For the type attribute, only change the value if you are deploying to a version of Windows that does not run under the Win32 API. Otherwise, use the suggested default. Update the description for your application. The element is optional, so you can either update its contents to include a brief description of your application or remove it from your manifest code. If you choose to remove it, be sure to remove both its opening and closing tags and any character data contained within them. For the dependent assembly section, update the featured attribute values for the element so that its values are appropriate to your version of MSXML. For the version and tokenKey attributes, verify that the values match those used in the assembly manifest that is provided for MSXML 4.0 when it installs under Windows XP. Assembly manifests are located in the special WinSxS/Manifest directory. The assembly manifest file for MSXML 4.0 is called msxml4.manifest. Save the application manifest to file in the same directory as the executable file for your application. Name your manifest file so that it has the same name as your application, and add the ".manifest" extension to the end of it. For example, if your application executable is called test.exe, the manifest file should be named test.exe.manifest. Decide how to package and deploy your application manifest with your application. As an alternative for new applications, you can include the application manifest directly in the header file for your application. In this case, also add the following line to the header file: CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "YourApp.exe.manifest" Be sure you update "YourApp.exe.manifest" with the name for your manifest file. After you add the line above to your application header file, the manifest will be directly included with your application binary file the next time it is compiled. If you do not choose to include the manifest in this way, include the manifest file separately in the Windows Installer package (.msi) you create to install your application. Note If you provide your manifest both separately and internally in the resource section of your compiled executable, the file system version of your manifest always takes precedence over the one included with the executable file. Test your application to ensure that you get the results you want. Testing your application before deployment is always important, but you should be sure that your test computer does not already have the side-by-side assembly for MSXML4.0 registered already on it. Otherwise, your testing will be compromised and the results will be incorrect. Deploy or update your application as a Windows Installer package. 聯盟----Visita網站http://www.vista.org.tw ---[ 發問前請先找找舊文章 ]--- 發表人 - axsoft 於 2002/12/04 09:19:55
系統時間:2024-07-01 21:03:15
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!