Edit

Share via


SystemColors Class

Definition

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

C#
public static class SystemColors
C#
public sealed class SystemColors
Inheritance
SystemColors

Examples

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.

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

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

Remarks

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.

Properties

ActiveBorder

Gets a Color structure that is the color of the active window's border.

ActiveCaption

Gets a Color structure that is the color of the background of the active window's title bar.

ActiveCaptionText

Gets a Color structure that is the color of the text in the active window's title bar.

AppWorkspace

Gets a Color structure that is the color of the application workspace.

ButtonFace

Gets a Color structure that is the face color of a 3-D element.

ButtonHighlight

Gets a Color structure that is the highlight color of a 3-D element.

ButtonShadow

Gets a Color structure that is the shadow color of a 3-D element.

Control

Gets a Color structure that is the face color of a 3-D element.

ControlDark

Gets a Color structure that is the shadow color of a 3-D element.

ControlDarkDark

Gets a Color structure that is the dark shadow color of a 3-D element.

ControlLight

Gets a Color structure that is the light color of a 3-D element.

ControlLightLight

Gets a Color structure that is the highlight color of a 3-D element.

ControlText

Gets a Color structure that is the color of text in a 3-D element.

Desktop

Gets a Color structure that is the color of the desktop.

GradientActiveCaption

Gets a Color structure that is the lightest color in the color gradient of an active window's title bar.

GradientInactiveCaption

Gets a Color structure that is the lightest color in the color gradient of an inactive window's title bar.

GrayText

Gets a Color structure that is the color of dimmed text.

Highlight

Gets a Color structure that is the color of the background of selected items.

HighlightText

Gets a Color structure that is the color of the text of selected items.

HotTrack

Gets a Color structure that is the color used to designate a hot-tracked item.

InactiveBorder

Gets a Color structure that is the color of an inactive window's border.

InactiveCaption

Gets a Color structure that is the color of the background of an inactive window's title bar.

InactiveCaptionText

Gets a Color structure that is the color of the text in an inactive window's title bar.

Info

Gets a Color structure that is the color of the background of a ToolTip.

InfoText

Gets a Color structure that is the color of the text of a ToolTip.

Menu

Gets a Color structure that is the color of a menu's background.

MenuBar

Gets a Color structure that is the color of the background of a menu bar.

MenuHighlight

Gets a Color structure that is the color used to highlight menu items when the menu appears as a flat menu.

MenuText

Gets a Color structure that is the color of a menu's text.

ScrollBar

Gets a Color structure that is the color of the background of a scroll bar.

UseAlternativeColorSet

Gets or sets a value that indicates whether the alternative color set is used.

Window

Gets a Color structure that is the color of the background in the client area of a window.

WindowFrame

Gets a Color structure that is the color of a window frame.

WindowText

Gets a Color structure that is the color of the text in the client area of a window.

Applies to

Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)