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.

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

public sealed class SystemColors
public final class SystemColors
public final class SystemColors
Not applicable.

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 op_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;
    }
}

private void button1_Click(System.Object sender, System.EventArgs e)
{
    if (this.get_BackColor().Equals(SystemColors.get_ControlDark())) {
        this.set_BackColor(SystemColors.get_Control());
    }
} //button1_Click

System.Object
  System.Drawing.SystemColors

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft