VSFlexGrid Control > VSFlexGrid Properties, Events, and Methods > VSFlexGrid Properties > Appearance Property |
Returns or sets the paint style of the control on an MDIForm or Form object.
Property Appearance As AppearanceSettings
Valid settings for the Appearance property are:
Constant |
Value |
Description |
flexFlat |
0 |
Flat appearance |
flex3D |
1 |
3D appearance |
flex3Dlight |
2 |
3D Light appearance |
flexXPThemes |
3 |
If the application is theme-enabled, the control paints fixed cells using themes. |
Notes on XP Themes
A visual style is included in the Windows XP release. In addition, other themes or visual styles are available in the Windows XP Plus Pack. You can use helper libraries and application programming interfaces (APIs) to incorporate a Windows XP visual style into an application with few code changes.
Windows XP applies a visual style to the non-client (frame and caption) area by default. To apply a visual style to common controls in the client area, you must use version 6 or later of the ComCtl32.dll file. ComCtl32.dll version 6 is not a redistributable system component. ComCtl32.dll version 6 contains both the user controls and the common controls. By default, applications use the controls that are defined in the User32.dll file. In addition, applications use the common controls that are defined in ComCtl32.dll version 5 by default.
To use the Windows XP visual styles from an application, you must add an application manifest file. This application manifest file should specify that ComCtl32.dll version 6 be used if it is available. One of the features that is included with this component is support for changing the appearance of controls in a window. Therefore, you must follow two steps to enable the Windows XP theme or visual style in Visual Basic 6.0:
1. Call the InitCommonControls function.
2. Add an application manifest file.
Example:
1. Call the InitCommonControls function:
You must call the InitCommonControls function in the Form_Initialize event:
Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
Private Sub Form_Initialize()
InitCommonControls
End Sub
Note: Do not call InitCommonControls in the Form_Load event. When you call InitCommonControls from the Form_Load event, the form cannot load.
2. Add a manifest file to your application:
You must add a file named YourApp.exe.manifest to the same folder as your executable file. For example, if your application is named Generic.exe, include a manifest file that is named Generic.exe.manifest. The application manifest file has Extensible Markup Language (XML) format similar to the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="CompanyName.ProductName.YourApp"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
After you place the application manifest file in the same folder as the executable file, you can run the compiled executable file to display the Windows XP visual style in the application.
Note: You cannot view visual styles when you run the compiled executable from the Visual Basic 6.0 Integrated Development Environment (IDE).
Although you can enable a Windows XP theme or visual style in Visual Basic 6.0 by calling InitCommonControls and by using an application manifest file, Microsoft does not officially support this feature.
If you enable a Windows XP theme in Visual Basic 6.0, you may encounter unexpected behavior. For example, if you place option buttons on top of a Frame control and then enable a Windows XP theme or visual style, the option buttons on the Frame control appear as black blocks when you run the executable file.
You can also embed the manifest into the executable file. In this case, you won't need the separate manifest file.
The manifest file should be embedded into the executable using a resource editor. The manifest should be embedded as a resource of type RT_RESOURCE and ID 1.
For details on this procedure, please refer to MSDN (Using Themes with Windows XP).