Export (0) Print
Expand All

SystemColors Class

Each property of the SystemColors class is a Color structure that is the color of a Windows display element.

System.Object
  System.Drawing.SystemColors

Namespace:  System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

public sealed class SystemColors

The SystemColors type exposes the following members.

  NameDescription
Public propertyStatic memberActiveBorderGets a Color structure that is the color of the active window's border.
Public propertyStatic memberActiveCaptionGets a Color structure that is the color of the background of the active window's title bar.
Public propertyStatic memberActiveCaptionTextGets a Color structure that is the color of the text in the active window's title bar.
Public propertyStatic memberAppWorkspaceGets a Color structure that is the color of the application workspace.
Public propertyStatic memberButtonFaceGets a Color structure that is the face color of a 3-D element.
Public propertyStatic memberButtonHighlightGets a Color structure that is the highlight color of a 3-D element.
Public propertyStatic memberButtonShadowGets a Color structure that is the shadow color of a 3-D element.
Public propertyStatic memberControlGets a Color structure that is the face color of a 3-D element.
Public propertyStatic memberControlDarkGets a Color structure that is the shadow color of a 3-D element.
Public propertyStatic memberControlDarkDarkGets a Color structure that is the dark shadow color of a 3-D element.
Public propertyStatic memberControlLightGets a Color structure that is the light color of a 3-D element.
Public propertyStatic memberControlLightLightGets a Color structure that is the highlight color of a 3-D element.
Public propertyStatic memberControlTextGets a Color structure that is the color of text in a 3-D element.
Public propertyStatic memberDesktopGets a Color structure that is the color of the desktop.
Public propertyStatic memberGradientActiveCaptionGets a Color structure that is the lightest color in the color gradient of an active window's title bar.
Public propertyStatic memberGradientInactiveCaptionGets a Color structure that is the lightest color in the color gradient of an inactive window's title bar.
Public propertyStatic memberGrayTextGets a Color structure that is the color of dimmed text.
Public propertyStatic memberHighlightGets a Color structure that is the color of the background of selected items.
Public propertyStatic memberHighlightTextGets a Color structure that is the color of the text of selected items.
Public propertyStatic memberHotTrackGets a Color structure that is the color used to designate a hot-tracked item.
Public propertyStatic memberInactiveBorderGets a Color structure that is the color of an inactive window's border.
Public propertyStatic memberInactiveCaptionGets a Color structure that is the color of the background of an inactive window's title bar.
Public propertyStatic memberInactiveCaptionTextGets a Color structure that is the color of the text in an inactive window's title bar.
Public propertyStatic memberInfoGets a Color structure that is the color of the background of a ToolTip.
Public propertyStatic memberInfoTextGets a Color structure that is the color of the text of a ToolTip.
Public propertyStatic memberMenuGets a Color structure that is the color of a menu's background.
Public propertyStatic memberMenuBarGets a Color structure that is the color of the background of a menu bar.
Public propertyStatic memberMenuHighlightGets a Color structure that is the color used to highlight menu items when the menu appears as a flat menu.
Public propertyStatic memberMenuTextGets a Color structure that is the color of a menu's text.
Public propertyStatic memberScrollBarGets a Color structure that is the color of the background of a scroll bar.
Public propertyStatic memberWindowGets a Color structure that is the color of the background in the client area of a window.
Public propertyStatic memberWindowFrameGets a Color structure that is the color of a window frame.
Public propertyStatic memberWindowTextGets a Color structure that is the color of the text in the client area of a window.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

Better performance is achieved by using the properties of the SystemPens or SystemBrushes classes rather than creating a new pen or brush based on a value from SystemColors. For example, if you wanted to get a brush for the face color of a 3-D element, use the SystemBrushes.Control property because it gets a brush that already exists, whereas calling the SolidBrush constructor with a parameter value of SystemColors.Control will create a new brush.

The following code example demonstrates the Equality operator and the SystemColors class. This example is designed to be used with a Windows Form that contains a button named Button1. Paste the following code into your form and associate the Button1_Click method with the button's Click event.


private void Button1_Click(System.Object sender, System.EventArgs e)
{

    if (this.BackColor == SystemColors.ControlDark)
    {
        this.BackColor = SystemColors.Control;
    }
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft