Mega Code Archive

 
Categories / Delphi / Ide Indy
 

Themed Delphi IDE

Title: Themed Delphi IDE Question: Ever wanted to test the look & feel of your applications under Windows XP with theming enabled without compiling and executing every time? -Just make Delphi look like it was written for Windows XP... Answer: #Menu { color: #909090; position: absolute; left: 20px; top: 49px; font: 7.5pt Verdana; } code {color: #004000} div.code {position: relative; left: 8px; padding: 4px; background: #F0F0F0} div.code code {color: black} p {text-indent: 0em} /* TEMPORARY STYLE */-- Themed Delphi IDE Make the IDE adapt to Windows XP Themes/Visual Styles posted 2003-31-05 The latest version of this article is always available at: http://www.blichmann.de/en/programming/delphi/themeddelphi/ Download the Manifest-file here 1. Overview Overview Intro and Motivation Before and After Applying the "hack" How it works Links Have fun! 2. Intro Sometimes, during the development of my applications, I wonder how they will look like when run on Windows XP with theming enabled. In my opinion, it is important that an application "fits" into its OS - be it Windows 9x/ME or NT/2k/XP. Consequently, my programs have to take visual styles into account to achieve this goal. To make the life of the Delphi-developer a bit easier (even more :-), I have created a small hack to apply visual styles to the Delphi-IDE. This allows you to test your Forms with the new user interface. Before and After This is how the Delphi-IDE (version 7.0) looks on a standard Windows XP system (click on the image to enlarge): The Delphi-IDE (standard look). In a few minutes, your IDE will look like this: "Visual Styles"-enabled Delphi Applying the "hack" To make Delphi look like a real Windows XP application, follow XXX easy steps: Copy the file "delphi32.manifest" (see above) into your installation directory (usually "C:\Program Files\Borland\Delphi7\bin"). Close Delphi, if it is currently open. Enable "theming", right-click on your desktop, choose "Properties" and select "Windows XP" from the "Theme"-Combobox. You may as well need to enable the "Use visual styles on windows and buttons"-option (click "Start", "Settings", "Control Panel" and choose "System" and open the "Advanced"-tab. Under "Performance", click "Settings". It's the last option in the checklistbox). Restart Delphi - voil, A fully themed IDE! How it works Beginning with Windows XP, Microsoft decided to create a new branch of the Windows Common Controls. To maintain compatibility with existing applications, every program that doesn't include a so-called "Manifest" automatically uses version 5.0.x of these controls. This "Manifest" can either be a directly-linked resource in the executable or - at the programmers' option - a simple XML-file with the same basename in the working directory of the application. When loading an executable, windows tries to find the corresponding "Manifest"-file before initializing the Windows Common Controls. If it is found, the application can make use of the new theming feature. Now the "trick": Using the file-based approach, it is possible to load the new Controls for _every_ application. Just copy the "Manifest"-file into the program's directory and rename it to the same basename. Be careful: Sometimes forcing to theme an application can lead to unexpected results (i.e. protection faults, random crashes, runtime exceptions...). This is especially the case with Delphi 6.0, since it's support for the "ListView"-control is somewhat broken with version 6.0 of the Common Controls. Delphi 5.0 and 7.0 should be safe, howeber. Links To learn more about "Manifest"-files and so-called "shared side-by-side assemblies", you may want to visit the following sites: Manifest Files Reference (MSDN) .NET Framework Home (this is where the assemblies originate) Have fun! I hope the information provided in this article helps you to improve your application's look & feel, so that they well integrate with the new Microsoft Windows "Luna" User Interface. Besides, Delphi just looks better when everything else is also themed. Don't hesitate - email me with your thoughts: feedback@blichmann.de