GetCurrentSystemTheme Method
Description
The GetCurrentSystemTheme function determines the current Windows XP theme in use.
Syntax
Public Function GetCurrentSystemTheme() As [XTPCurrentSystemTheme](XtremeCalendarControl~Enumerations~XTPCurrentSystemTheme_EN.md)
Return Type
Returns a member of the XTPCurrentSystemTheme enumeration that represents the current Windows theme in use, which can be one of the following values:
- xtpSystemThemeUnknown - No known theme in use
- xtpSystemThemeBlue - Blue theme in use
- xtpSystemThemeOlive - Olive theme in use
- xtpSystemThemeSilver - Silver theme in use
Remarks
If the operating system used is not Windows XP or if the Blue, Silver, or Olive theme is not used when running Windows XP, then GetCurrentSystemTheme will return xtpSystemThemeUnknown.
Example
GetCurrentSystemTheme Sample (Visual Basic)
This sample illustrates how to use the GetCurrentSystemTheme function to determine the current Windows XP theme. If a Windows XP theme is not used, then applications using the xtpThemeOffice2003 can emulate the Windows XP Olive, Silver, and Gold themes using the SystemTheme property. Themes can be emulated on all operating systems.
Private Sub MDIForm_Initialize()
Dim cbColorManager As ColorManager
Set cbColorManager = CommandBarsGlobalSettings.ColorManager
' Get current system theme
Select Case cbColorManager.GetCurrentSystemTheme
' If OS is Windows XP and the theme is Olive, Silver, or Blue, then use OS settings for theme
Case xtpSystemThemeBlue, _
xtpSystemThemeSilver, _
xtpSystemThemeOlive:
' Running Windows XP and using a luna theme
Debug.Print cbColorManager.GetCurrentSystemTheme
CommandBars.VisualTheme = xtpThemeOffice2003
' If OS is NOT Windows XP and/or theme is not Olive, Silver, or Blue, then set theme to Auto.
Case xtpSystemThemeUnknown:
cbColorManager.SystemTheme = xtpSystemThemeAuto
CommandBars.VisualTheme = xtpThemeOfficeXP
End Select
End Sub
See Also
- ColorManager Object
- XTPCurrentSystemTheme Enumeration
- SystemTheme Property
- SetColor Method
- Color Property
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.