Skip to content

SetColor Method

Description

The SetColor function sets the colors for one or more display elements. Display elements are the various parts of a window and the display that appear on the system display screen.

Display elements to be changed: the color of the selected element will be replaced with the color value in the Color parameter.

Syntax

Public Sub SetColor( _
    ByVal Index As XTPColorManagerColor, _
    ByVal Color As ULong _
)
  • Index: One of the values from the XTPColorManagerColor enumeration (see table below).
  • Color: The new red, green, blue (RGB) color value for the display element specified by Index.

Parameters

Value Description
STDCOLOR_BACKGROUND Desktop color.
STDCOLOR_ACTIVECAPTION Color of the title bar for the active window. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.
STDCOLOR_INACTIVECAPTION Color of the title bar for the inactive window. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.
STDCOLOR_MENU Menu background color.
STDCOLOR_WINDOW Window background color.
STDCOLOR_WINDOWFRAME Window frame color.
STDCOLOR_MENUTEXT Color of text on menus.
STDCOLOR_WINDOWTEXT Color of text in windows.
STDCOLOR_CAPTIONTEXT Color of text in caption, size box, and scroll arrow.
STDCOLOR_ACTIVEBORDER Border color of active window.
STDCOLOR_INACTIVEBORDER Border color of inactive window.
STDCOLOR_APPWORKSPACE Background color of multiple-document interface (MDI) applications.
STDCOLOR_HIGHLIGHT Background color of items selected in a control.
STDCOLOR_HIGHLIGHTTEXT Text color of items selected in a control.
STDCOLOR_BTNFACE Face color for three-dimensional display elements and for dialog box backgrounds.
STDCOLOR_BTNSHADOW Color of shading on the edge of command buttons.
STDCOLOR_GRAYTEXT Grayed (disabled) text.
STDCOLOR_BTNTEXT Text color on push buttons.
STDCOLOR_INACTIVECAPTIONTEXT Color of text in an inactive caption.
STDCOLOR_BTNHIGHLIGHT Highlight color for 3-D display elements.
STDCOLOR_3DDKSHADOW Darkest shadow color for 3-D display elements.
STDCOLOR_3DLIGHT Second lightest 3-D color after 3DHighlight; light color for three-dimensional display elements (for edges facing the light source).
STDCOLOR_INFOTEXT Color of text in ToolTips.
STDCOLOR_INFOBK Background color of ToolTips.
STDCOLOR_HOTLIGHT Color for a hot-tracked item. Single-clicking a hot-tracked item executes the item.
STDCOLOR_GRADIENTACTIVECAPTION Right side color in the color gradient of an active window's title bar. COLOR_ACTIVECAPTION specifies the left side color.
STDCOLOR_GRADIENTINACTIVECAPTION Right side color in the color gradient of an inactive window's title bar. COLOR_INACTIVECAPTION specifies the left side color.
XPCOLOR_TOOLBAR_FACE XP toolbar background color.
XPCOLOR_HIGHLIGHT XP menu item selected color.
XPCOLOR_HIGHLIGHT_BORDER XP menu item selected border color.
XPCOLOR_HIGHLIGHT_PUSHED XP menu item pushed color.
XPCOLOR_HIGHLIGHT_CHECKED XP menu item checked color.
XPCOLOR_HIGHLIGHT_CHECKED_BORDER An RGB value that represents the XP menu item checked border color.
XPCOLOR_ICONSHADDOW XP menu item icon shadow.
XPCOLOR_GRAYTEXT XP menu item disabled text color.
XPCOLOR_TOOLBAR_GRIPPER XP toolbar gripper color.
XPCOLOR_SEPARATOR XP toolbar separator color.
XPCOLOR_DISABLED XP menu icon disabled color.
XPCOLOR_MENUBAR_FACE XP menu item text background color.
XPCOLOR_MENUBAR_EXPANDED XP hidden menu commands background color.
XPCOLOR_MENUBAR_BORDER XP menu border color.
XPCOLOR_MENUBAR_TEXT XP menu item text color.
XPCOLOR_HIGHLIGHT_TEXT XP menu item selected text color.
XPCOLOR_TOOLBAR_TEXT XP toolbar text color.
XPCOLOR_PUSHED_TEXT XP toolbar pushed text color.
XPCOLOR_TAB_INACTIVE_BACK XP inactive tab background color.
XPCOLOR_TAB_INACTIVE_TEXT XP inactive tab text color.
XPCOLOR_HIGHLIGHT_PUSHED_BORDER An RGB value that represents the XP border color for pushed-in 3D elements.
XPCOLOR_3DFACE XP face color for three-dimensional display elements and for dialog box backgrounds.
XPCOLOR_3DSHADOW XP shadow color for three-dimensional display elements (for edges facing away from the light source).
XPCOLOR_FRAME Office 2003 frame color.
XPCOLOR_SPLITTER_FACE XP splitter face color.
XPCOLOR_LABEL (xtpControlLabel) Color for Command Bars label control.
XPCOLOR_STATICFRAME WinXP static frame color.

Remarks

  • Using SetColor for the CommandBars control changes the color of the selected display element for the CommandBars to the specified color. This does not affect other control types.
  • SetColor applies colors globally — all CommandBars controls will use these colors.
  • Use SetSpecialColor to set colors for individual CommandBars controls without changing the global settings: XtremeCommandBars~CommandBars~SetSpecialColor.md
  • Note: Each XTPVisualTheme that can be set for the CommandBars uses different display elements. Changing the color of a display element in one theme might not change the same display element in a different theme. Also, the color of a display element may vary depending on whether luna colors are enabled or disabled: XtremeCommandBars~CommandBarsOptions~LunaColors.md

Example (Visual Basic)

This sample illustrates how to use SetColor to create a custom CommandBar appearance.

Dim CommandBars As CommandBars
Set CommandBars = fMainForm.CommandBars

CommandBars.VisualTheme = xtpThemeOffice2003

With CommandBars.GlobalSettings.ColorManager
    .SetColor XPCOLOR_TOOLBAR_TEXT, vbBlack
    .SetColor STDCOLOR_BTNFACE, RGB(214, 211, 206)
    .SetColor XPCOLOR_HIGHLIGHT_CHECKED, RGB(214, 215, 222)
    .SetColor XPCOLOR_HIGHLIGHT_PUSHED_BORDER, RGB(8, 36, 107)
    .SetColor XPCOLOR_HIGHLIGHT_CHECKED_BORDER, RGB(8, 36, 107)
    .SetColor XPCOLOR_HIGHLIGHT_PUSHED, RGB(181, 190, 214)
    .SetColor XPCOLOR_HIGHLIGHT, RGB(214, 215, 222)
    .SetColor XPCOLOR_HIGHLIGHT_BORDER, RGB(8, 36, 107)
    .SetColor COLOR_BTNSHADOW, RGB(214, 214, 214)
End With

CommandBars.Options.LunaColors = False
CommandBars.RecalcLayout

See Also

  • ColorManager Object: XtremeCommandBars~ColorManager.md
  • Color Property: XtremeCommandBars~ColorManager~Color.md
  • GetCurrentSystemTheme Method: XtremeCommandBars~ColorManager~GetCurrentSystemTheme.md
  • SystemTheme Property: XtremeCommandBars~ColorManager~SystemTheme.md
  • XTPColorManagerColor Enumeration: XtremeCommandBars~Enumerations~XTPColorManagerColor_EN.md

Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.