Themed Delphi IDE

Make the IDE adapt to Windows XP Themes/Visual Styles


posted 2003-31-05


1. Overview

  1. Overview
  2. Intro and Motivation
  3. Before and After
  4. Applying the "hack"
  5. How it works
  6. Links
  7. 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:
  1. Copy the file "delphi32.manifest" (see above) into your installation directory (usually "C:\Program Files\Borland\Delphi7\bin").
  2. Close Delphi, if it is currently open.
  3. 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).
  4. 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:

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