Hello,
this function will fix properly following issues with Visual Styles (Themes):
- Frame control (black background on controls)
- Focus rectangles not shown
- Accelerator keys not shown
- CommandButton, CheckBox and OptionButton with Graphical Style not themed
In order to use this function you first need to create a manifest:
Or just put attached resource fille into your application. That is the same just compiled into a resource.Code:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" language="*" processorArchitecture="*" publicKeyToken="6595b64144ccf1df"/> </dependentAssembly> </dependency> </assembly>
This need to be put on the Sub Main:
To put on every Form Load event:Code:Private Sub Main() Call InitVisualStyles Form.Show vbModeless End Sub
The Code is too long to put directly here. So I have attached it. (see CodeVisualStyles.txt)Code:Private Sub Form_Load() Call SetupVisualStyles(Me) End Sub
EDIT: Fixed the EnabledVisualStyles() function. It returned a wrong result when the application was marked with the "Disable visual themes" under the "Compatibility" tab.
EDIT: Fixed a bug that the "hot" flag gets cleared when focus is lost but mouse is still hovering over the button.


Reply With Quote


