menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class MenuColors - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class MenuColors

    Provides static properties to access the colors used by different components in the XPMenus framework.

    Inheritance
    System.Object
    MenuColors
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Windows.Forms
    Assembly: Syncfusion.Shared.Base.dll
    Syntax
    public class MenuColors
    Remarks

    The primary objective of this class is to let you specify custom colors for the different regions of the XPMenus components. When no colors are provided, this class returns the default colors usually synthesized from the System Colors. If you have to reset a property that you set before, simply set it to be Color.Empty; the next time the property is queried, it will return the default color.

    If you are a consumer of the colors in this class, then note that the colors returned by properties in this class need to be reinitialized when the system color changes. This class doesn't listen to the system color change event, instead it expects the consumer to notify it when the system color changes. To avoid redundant updates by multiple consumers, a unique notification pattern is recommended.

    To notify system color changes, you should listen to the System.Windows.Forms.Control.SystemColorsChanged event and call the SysColorsChanged(Boolean) method. The SysColorsChanged method will let you specify whether to update the colors immediately or later with a call to UpdateMenuColors(). You should choose to update immediately if you will use the new colors to update certain properties in your control (Backcolor, for example). On the other hand, if you use the colors within and only within your Paint event, then update the colors later in the beginning of your Paint method with a call to UpdateMenuColors. Note that the UpdateMenuColors method will actually update the colors only if necessary, letting you call it multiple times without performance hit.

    There is also a MenuColorsChanged event that gets fired whenever colors are updated, either due to change in System Colors (notified using the above pattern) or when a custom color is set on any of the properties.

    Constructors

    MenuColors()

    Declaration
    public MenuColors()

    Properties

    CheckedSelColor

    Gets / sets the selected color for a checked menu item in a toolbar.

    Declaration
    public static Color CheckedSelColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    CommandBarBackColor

    Gets / sets the background color for a toolbar / commandbar.

    Declaration
    public static Color CommandBarBackColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    DisabledMenuTextColorBase

    Gets / sets the text color base for the text in the disabled menu items.

    Declaration
    public static Color DisabledMenuTextColorBase { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    When you specify a custom color, ControlPaint.LightLight will be applied on it before using that color.

    DisabledToolbarItemTextColorBase

    Gets / sets the text color base for the text in the disabled toolbar items.

    Declaration
    public static Color DisabledToolbarItemTextColorBase { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    DropDownBorderColor

    Gets / sets the border color for a drop-down menu.

    Declaration
    public static Color DropDownBorderColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    See Also
    MenuBGColor

    ExpandedMenuStripBackColor

    Gets / sets the Backcolor for the expanded,
    left-aligned menu strip region. This is the region you see when a partial menu gets expanded to show all the menu items.

    Declaration
    public static Color ExpandedMenuStripBackColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    FloatingCommandBarCaptionColor

    Gets / sets the Caption background color for a floating toolbar / commandbar.

    Declaration
    public static Color FloatingCommandBarCaptionColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    InactiveItemAlphaBlendFactor

    Gets / sets the alpha-blend factor to use to shade the inactive menu item's icons. (255 for no alpha-blending; 0 will completely hide the item)

    Declaration
    public static int InactiveItemAlphaBlendFactor { get; set; }
    Property Value
    Type Description
    System.Int32

    A value in the range 1 to 255; -1 will reset to default value. Default is 175.

    Remarks

    255 will draw the icon without any alpha blending; 1 will almost hide the icons. This setting will be ignored when XPThemes is turned on.

    MainMenuBackColor

    Gets / sets the background color for the main-menu bar.

    Declaration
    public static Color MainMenuBackColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    MenuActiveTextColor

    Gets / sets the active text color of the menu and toolbar items.

    Declaration
    public static Color MenuActiveTextColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    MenuBGColor

    Gets / sets the background color of a drop-down menu.

    Declaration
    public static Color MenuBGColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a System Color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    See Also
    MenuLeftStripColor

    MenuLeftStripColor

    Gets / sets the color for the left aligned strip in a drop-down menu where images and check boxes are shown.

    Declaration
    public static Color MenuLeftStripColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a System Color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    See Also
    MenuBGColor

    MenuTextColor

    Gets / sets the text color of the menu and toolbar items.

    Declaration
    public static Color MenuTextColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color, the next time it is queried.

    PressedSelColor

    Gets / sets the selected-pressed color for a menu item in a toolbar.

    Declaration
    public static Color PressedSelColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a System Color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    SelBorderColor

    Gets / sets the border color for a selected menu item in a toolbar.

    Declaration
    public static Color SelBorderColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    SelColor

    Gets / sets the selected color for a menu item in a toolbar.

    Declaration
    public static Color SelColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    SelTextColor

    Gets / sets the selected text color for an item in a toolbar.

    Declaration
    public static Color SelTextColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    StatusBarBackColor

    Gets / sets the background color for the Status Bar.

    Declaration
    public static Color StatusBarBackColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The default value is derived from a system color.

    Remarks

    Setting this property to Color.Empty will actually reset the previous set color and make this property return the default color the next time it is queried.

    Methods

    SysColorsChanged(Boolean)

    Call this method to indicate that the system colors have changed.

    Declaration
    public static void SysColorsChanged(bool updateColorsNow)
    Parameters
    Type Name Description
    System.Boolean updateColorsNow

    Indicates whether to update colors immediately or later with a call to UpdateMenuColors().

    Remarks

    Take a look at the MenuColors class reference for the recommended system color change notification pattern.

    UpdateMenuColors()

    Initializes default colors based on SystemColors.

    Declaration
    public static void UpdateMenuColors()
    Remarks

    Calling this will not affect the custom colors set using the properties.

    Events

    MenuColorsChanged

    Fired when the colors have changed either because of change in system colors or when a custom color is specified using one of the properties.

    Declaration
    public static event EventHandler MenuColorsChanged
    Event Type
    Type
    System.EventHandler
    Remarks

    Take a look at the class reference for this class for information on how to notify this class regarding system color changes.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved