- The event calls the Application.EnableVisualStyles method again.
- The event calls the Application.EnableVisualStyles method when a form loads or after a form loads.
- Reorganize your code so that you only call the EnableVisualStyles method one time before you load any form. The following code example illustrates how to organize your code:
Public Sub Main()
Application.Run(New frmMain) 'Note: The frmMain form is the first form to open.
- Create and then add an XML manifest file as a resource that enables your application to use visual styles. To do this, follow these steps:
- Link to ComCtl32.lib, and then call the InitCommonControlsEx function.
- Add a file that is named YourApp.exe.manifest that has the XML manifest format to the source tree. The source tree must be similar to the following code example:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<description>Type your application description here.</description>
- Add the XML manifest to the resource file of your application by using the following code example: Note You must add this line of code on one line. Alternatively, you can put the XML manifest file in the same folder as the executable file of your application. The operating system loads the XML manifest from the file system. Then, the operating system examines the resource section of the executable file. The file system version takes precedence.
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "YourApp.exe.manifest"
Article ID: 897298 - Last Review: 29 Mar 2017 - Revision: 2