Windows XP introduced an updated, more modern User Interface. With a small amount of work, you can take advantage of the Windows XP visual styles in your applications.
There are three basic steps:
Version 1.1 of the .NET Framework introduced a simplified method of incorporating XP themes in your applications by using the Application.EnableVisualStyles method in the application’s entry point:
Public Shared Sub Main()
static void Main()
However, this method has been proven unreliable. Some controls may not pick up the theme, and images have been known to disappear from ToolBars, TreeViews, and ListViews. Microsoft suggests calling Application.DoEvents as a workaround, but developers have reported memory leaks and unhandled exceptions using this workaround.
The safest way to ensure your application’s integrity is to stick with the manifest approach.
Some controls support XP styles with no additional work, however controls that derive from the ButtonBase class (Button, CheckBox, RadioButton) and the GroupBox control must have their FlatStyle property set to System. Setting this property to System lets the operating system determine how the control displays.
Your application must include a manifest file that tells Windows XP that it supports themes. The easiest way to create this file is to use another application's manifest as a template, or use the template below:
<? xml version ="1.0" encoding ="UCS-2" standalone ="yes"?>
< assembly xmlns ="urn:schemas-microsoft-com:asm.v1" manifestVersion ="1.0">
< description >My Application Description </description >
< dependency >
</ dependency >
</ assembly >
To do this, include the manifest as a file and place it in the same directory as your assembly (exe or dll).
The file should be named as follows:
Where application_name is the name of your application. For example, if your application is called Editor.exe, your manifest file name would be:
Alternatively, you can include your manifest as a resource by following these steps:
Thank you! Thank you! I just finished reading this document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.