Windows XP Theme Manager is a suite of three classes which enable access to Windows XP theme support from Delphi and Borland C++ Builder applications. At the time of creating the name of this suite Windows XP was the only Windows with the new theme support. However, since the support for theming remains the same in Windows Vista, the component works also there, just like on XP.
There's a translation of this page to the Slovanian language done by Damian Erjavec.
Windows XP Theme Manager is release under the MIT license.
TThemeServices is a wrapper around the themes APIs and allows an application or control to use theme functions without worrying about managing theme data and listen to theme changes in the system. It has a very small memory footprint and does not appear on the component palette.
TThemeManager is a component that takes important measures to allow VCL applications to work with Windows XP themes and modifies some controls to match the general theme look. It does not need to modify any VCL units nor to change code in an application. It is indeed a drop-and-forget component. Internally a TThemeServices instance is used for painting, which is also exposed as property, so an application does not need to create an own one if it needs to paint theme elements.
TThemeManagerDB is the third class in the bundle and is an enhanced TThemeManager class which takes care for DB controls. It is located in an own unit because it has to import database units which are not of general interest in all applications.
- No XML manifest resource is included in the application. In order to avoid problems by controls, which use the themes units, you must either add a manifest file (YourAppName.exe.manifest) to the application folder or compile your application with the WinXP.res resource file. You will find both, the resource file as well as a manifest file (which can be used for any application, just rename it accordingly) in the Theme Explorer folder.
- The themes DLL is dynamically loaded to avoid breaking applications on older Windows systems.
- The entire theme management is done by the TThemeServices class. This includes awareness for theme changes as well as opening and closing theme data.
- A, as I think, more logical identification for the many theme parts and states is used, which makes usage much more intuitive.
- Various VCL controls are subclassed by TThemeManager, either to provide a bug fix or to fix the painting in general. The theme manager is aware of control additions and removals and does the subclassing transparently. The list of subclassed controls includes:
- TListView, The bug in report mode without images in the header had to be fixed.
- TAnimate, The background of the (transparent) animation window must be fixed (see also topic Known issues).
- TButtonControl, This includes TButton, TBitBtn, T(Custom)CheckBox and TRadioButton. TBitBtn must be fully drawn by the manager, while check boxes, radio buttons and TButtons must be made transparent.
- TCustomGroupBox, Necessary to subclass because it must be fully drawn by the manager (transparency, rounded border, themed caption).
- TTabSheet, The tab sheet background must be painted using the parent's background instead of the own one (simulation of transparency). Additionally, its non-client area must be painted in a theme fashion if the border size is > 0.
- TTrackBar, Also the trackbar must be made transparent.
- TStatusBar, The status bar has a gradient background which is drawn by the Theme Manager. Additionally, it needs repaints on resize to avoid size grip smearing and wrong text output.
- TSpeedButton, This control, which is very similar to TButton and TBitBtn is not a normal Windows control, so it has fully to be painted by the theme manager.
- TCustomPanel, If a panel has the same color as its parent control, then it is painted transparently too.
- TCustomFrame, Frames are always painted transparently because this serves their purpose much better.
- TDBLookupComboBox, The lookup combobox needs a themed border and drop down button.
- TCustomStaticText, The static text control is a normal window control and its background must be made transparent.
- TCheckListBox, The check list box control has own paint routines for the check boxes, which must be now drawn in themed style.
- TWinControl, If a window control is not already in one of the other list then it is separately subclassed to have its border painted in themed fashion (e.g. to fix wrong borders of TScrollBox and TRichEdit). Additionally, TScrollBox's background is painted transparently here.
- Three additional fixes are required, which don't need subclassing:
- TLabel should be transparent to show correct background.
- TToolBar should be transparent as well to show correct background.
- TToolButton uses csCaptureMouse in its control style which prevents proper working on Windows XP. Hence this style must be removed. Also here is a known problem (see below).
Theme Manager comes with an own setup program that makes installation extremely simple. Thanks to Jim Kueneman (www.mustangpeak.net), who created the initial version and helped me so very much to finally get my own installer done. With this installer not only is it simple to install the Delphi package but also C++ Builder users have a much easier time. Note: The demo application (Theme Explorer) has been created using Delphi 7. The form files are stored however as binary. When opening the project with Delphi 6/BCB 6 or lower you might get some warnings about unknown properties. Simply ignore these messages. Additionally, there might still be units, which are not known to Delphi/BCB versions earlier than 7. Simply remove these references from the uses clauses whenever they are mentioned by the compiler.
Note also that the DB aware demo application needs DBDEMOS to work properly.
Update June 2015: the Free Pascal project asked me for a license change to make the package compatible with their software. So I decided to switch to the MIT license (from a custom freeware license). However, since I can no longer create the TM setup it has been taken offline and from now on only the source code is available for download.
The theme manager cannot fix everything. Particularly controls which are fully drawn by the VCL remain as they are (exception: TSpeedButton), because the paint code would have to be copied out from the VCL source code for modification, which is not allowed.
- The TAnimate control does not behave as documented. Regardless of what is done in WM_CTLCOLORSTATIC the control always seems to erase its background, making it so impossible to simulate a transparent background. Custom draw is not supported for TAnimate so this option is also not available.
- TPageControl does no longer support tab styles other than tsTabs. Additionally, the default themes for Windows XP do not draw tabs correctly if they are not at top of the page control.
- TToolButton with tbsDropDown style does not trigger its Click event when csCaptureMouse is removed from the control style. Hence tool buttons with that style are taken out from the automatic adjustment. This in turn makes them however showing wrongly when pressed. No fix known yet.
The following controls are VCL only and need full rework for themed painting or are not intended to work with themes:
- TCustomGrid (and all descentants like database grids). The border of grids is however painted in themed fashion.
- TPageScroller, The page scroller control is not subclassed. It is not clear to me how it must look because it is nowhere used in Windows XP (at least I did not find any usage).
Third party and special controls:
- I have not considered additional controls like QuickReports, TeeChart and so on.
|Resource file containing a generic XML manifest that can be used to enable Windows XP theme support for your application.|
|Version: n/a||Last change: 03. Feb 2007|
|Download count: 151887||Size: 1 KB|
|Author: Mike Lischke||Website: www.soft-gems.net|
|Platform: Delphi 4 - 7, BCB 4 - 7||Type of download: Binary data|