KnownColor Enumeration
Collapse the table of content
Expand the table of content

KnownColor Enumeration

 

Specifies the known system colors.

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

public enum KnownColor

Member nameDescription
ActiveBorder

The system-defined color of the active window's border.

ActiveCaption

The system-defined color of the background of the active window's title bar.

ActiveCaptionText

The system-defined color of the text in the active window's title bar.

AliceBlue

A system-defined color.

AntiqueWhite

A system-defined color.

AppWorkspace

The system-defined color of the application workspace. The application workspace is the area in a multiple-document view that is not being occupied by documents.

Aqua

A system-defined color.

Aquamarine

A system-defined color.

Azure

A system-defined color.

Beige

A system-defined color.

Bisque

A system-defined color.

Black

A system-defined color.

BlanchedAlmond

A system-defined color.

Blue

A system-defined color.

BlueViolet

A system-defined color.

Brown

A system-defined color.

BurlyWood

A system-defined color.

ButtonFace

The system-defined face color of a 3-D element.

ButtonHighlight

The system-defined color that is the highlight color of a 3-D element. This color is applied to parts of a 3-D element that face the light source.

ButtonShadow

The system-defined color that is the shadow color of a 3-D element. This color is applied to parts of a 3-D element that face away from the light source.

CadetBlue

A system-defined color.

Chartreuse

A system-defined color.

Chocolate

A system-defined color.

Control

The system-defined face color of a 3-D element.

ControlDark

The system-defined shadow color of a 3-D element. The shadow color is applied to parts of a 3-D element that face away from the light source.

ControlDarkDark

The system-defined color that is the dark shadow color of a 3-D element. The dark shadow color is applied to the parts of a 3-D element that are the darkest color.

ControlLight

The system-defined color that is the light color of a 3-D element. The light color is applied to parts of a 3-D element that face the light source.

ControlLightLight

The system-defined highlight color of a 3-D element. The highlight color is applied to the parts of a 3-D element that are the lightest color.

ControlText

The system-defined color of text in a 3-D element.

Coral

A system-defined color.

CornflowerBlue

A system-defined color.

Cornsilk

A system-defined color.

Crimson

A system-defined color.

Cyan

A system-defined color.

DarkBlue

A system-defined color.

DarkCyan

A system-defined color.

DarkGoldenrod

A system-defined color.

DarkGray

A system-defined color.

DarkGreen

A system-defined color.

DarkKhaki

A system-defined color.

DarkMagenta

A system-defined color.

DarkOliveGreen

A system-defined color.

DarkOrange

A system-defined color.

DarkOrchid

A system-defined color.

DarkRed

A system-defined color.

DarkSalmon

A system-defined color.

DarkSeaGreen

A system-defined color.

DarkSlateBlue

A system-defined color.

DarkSlateGray

A system-defined color.

DarkTurquoise

A system-defined color.

DarkViolet

A system-defined color.

DeepPink

A system-defined color.

DeepSkyBlue

A system-defined color.

Desktop

The system-defined color of the desktop.

DimGray

A system-defined color.

DodgerBlue

A system-defined color.

Firebrick

A system-defined color.

FloralWhite

A system-defined color.

ForestGreen

A system-defined color.

Fuchsia

A system-defined color.

Gainsboro

A system-defined color.

GhostWhite

A system-defined color.

Gold

A system-defined color.

Goldenrod

A system-defined color.

GradientActiveCaption

The system-defined color of the lightest color in the color gradient of an active window's title bar.

GradientInactiveCaption

The system-defined color of the lightest color in the color gradient of an inactive window's title bar.

Gray

A system-defined color.

GrayText

The system-defined color of dimmed text. Items in a list that are disabled are displayed in dimmed text.

Green

A system-defined color.

GreenYellow

A system-defined color.

Highlight

The system-defined color of the background of selected items. This includes selected menu items as well as selected text.

HighlightText

The system-defined color of the text of selected items.

Honeydew

A system-defined color.

HotPink

A system-defined color.

HotTrack

The system-defined color used to designate a hot-tracked item. Single-clicking a hot-tracked item executes the item.

InactiveBorder

The system-defined color of an inactive window's border.

InactiveCaption

The system-defined color of the background of an inactive window's title bar.

InactiveCaptionText

The system-defined color of the text in an inactive window's title bar.

IndianRed

A system-defined color.

Indigo

A system-defined color.

Info

The system-defined color of the background of a ToolTip.

InfoText

The system-defined color of the text of a ToolTip.

Ivory

A system-defined color.

Khaki

A system-defined color.

Lavender

A system-defined color.

LavenderBlush

A system-defined color.

LawnGreen

A system-defined color.

LemonChiffon

A system-defined color.

LightBlue

A system-defined color.

LightCoral

A system-defined color.

LightCyan

A system-defined color.

LightGoldenrodYellow

A system-defined color.

LightGray

A system-defined color.

LightGreen

A system-defined color.

LightPink

A system-defined color.

LightSalmon

A system-defined color.

LightSeaGreen

A system-defined color.

LightSkyBlue

A system-defined color.

LightSlateGray

A system-defined color.

LightSteelBlue

A system-defined color.

LightYellow

A system-defined color.

Lime

A system-defined color.

LimeGreen

A system-defined color.

Linen

A system-defined color.

Magenta

A system-defined color.

Maroon

A system-defined color.

MediumAquamarine

A system-defined color.

MediumBlue

A system-defined color.

MediumOrchid

A system-defined color.

MediumPurple

A system-defined color.

MediumSeaGreen

A system-defined color.

MediumSlateBlue

A system-defined color.

MediumSpringGreen

A system-defined color.

MediumTurquoise

A system-defined color.

MediumVioletRed

A system-defined color.

Menu

The system-defined color of a menu's background.

MenuBar

The system-defined color of the background of a menu bar.

MenuHighlight

The system-defined color used to highlight menu items when the menu appears as a flat menu.

MenuText

The system-defined color of a menu's text.

MidnightBlue

A system-defined color.

MintCream

A system-defined color.

MistyRose

A system-defined color.

Moccasin

A system-defined color.

NavajoWhite

A system-defined color.

Navy

A system-defined color.

OldLace

A system-defined color.

Olive

A system-defined color.

OliveDrab

A system-defined color.

Orange

A system-defined color.

OrangeRed

A system-defined color.

Orchid

A system-defined color.

PaleGoldenrod

A system-defined color.

PaleGreen

A system-defined color.

PaleTurquoise

A system-defined color.

PaleVioletRed

A system-defined color.

PapayaWhip

A system-defined color.

PeachPuff

A system-defined color.

Peru

A system-defined color.

Pink

A system-defined color.

Plum

A system-defined color.

PowderBlue

A system-defined color.

Purple

A system-defined color.

Red

A system-defined color.

RosyBrown

A system-defined color.

RoyalBlue

A system-defined color.

SaddleBrown

A system-defined color.

Salmon

A system-defined color.

SandyBrown

A system-defined color.

ScrollBar

The system-defined color of the background of a scroll bar.

SeaGreen

A system-defined color.

SeaShell

A system-defined color.

Sienna

A system-defined color.

Silver

A system-defined color.

SkyBlue

A system-defined color.

SlateBlue

A system-defined color.

SlateGray

A system-defined color.

Snow

A system-defined color.

SpringGreen

A system-defined color.

SteelBlue

A system-defined color.

Tan

A system-defined color.

Teal

A system-defined color.

Thistle

A system-defined color.

Tomato

A system-defined color.

Transparent

A system-defined color.

Turquoise

A system-defined color.

Violet

A system-defined color.

Wheat

A system-defined color.

White

A system-defined color.

WhiteSmoke

A system-defined color.

Window

The system-defined color of the background in the client area of a window.

WindowFrame

The system-defined color of a window frame.

WindowText

The system-defined color of the text in the client area of a window.

Yellow

A system-defined color.

YellowGreen

A system-defined color.

The following code example demonstrates how to use the KnownColor enumeration to print out the names and colors of all its values. This example is designed to be used with Windows Forms. Create a form and paste the following code into it. Call the DisplayKnownColors method in the form's Paint event-handling method, passing e as PaintEventArgs.

private void DisplayKnownColors(PaintEventArgs e)
{
    this.Size = new Size(650, 550);

    // Get all the values from the KnownColor enumeration.
    System.Array colorsArray = Enum.GetValues(typeof(KnownColor));
    KnownColor[] allColors = new KnownColor[colorsArray.Length];

    Array.Copy(colorsArray, allColors, colorsArray.Length);

    // Loop through printing out the values' names in the colors 
    // they represent.
    float y = 0;
    float x = 10.0F;

    for(int i = 0; i < allColors.Length; i++)
    {

        // If x is a multiple of 30, start a new column.
        if (i > 0 && i % 30 == 0)
        {
            x += 105.0F;
            y = 15.0F;
        }
        else
        {
            // Otherwise, increment y by 15.
            y += 15.0F;
        }

        // Create a custom brush from the color and use it to draw
        // the brush's name.
        SolidBrush aBrush = 
            new SolidBrush(Color.FromName(allColors[i].ToString()));
        e.Graphics.DrawString(allColors[i].ToString(), 
            this.Font, aBrush, x, y);

        // Dispose of the custom brush.
        aBrush.Dispose();
    }

}

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft