KnownColor KnownColor KnownColor KnownColor Enum

Definition

Specifies the known system colors.

public enum class KnownColor
public enum KnownColor
type KnownColor = 
Public Enum KnownColor
Inheritance

Fields

ActiveBorder ActiveBorder ActiveBorder ActiveBorder 1

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

ActiveCaption ActiveCaption ActiveCaption ActiveCaption 2

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

ActiveCaptionText ActiveCaptionText ActiveCaptionText ActiveCaptionText 3

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

AliceBlue AliceBlue AliceBlue AliceBlue 28

A system-defined color.

AntiqueWhite AntiqueWhite AntiqueWhite AntiqueWhite 29

A system-defined color.

AppWorkspace AppWorkspace AppWorkspace AppWorkspace 4

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 Aqua Aqua Aqua 30

A system-defined color.

Aquamarine Aquamarine Aquamarine Aquamarine 31

A system-defined color.

Azure Azure Azure Azure 32

A system-defined color.

Beige Beige Beige Beige 33

A system-defined color.

Bisque Bisque Bisque Bisque 34

A system-defined color.

Black Black Black Black 35

A system-defined color.

BlanchedAlmond BlanchedAlmond BlanchedAlmond BlanchedAlmond 36

A system-defined color.

Blue Blue Blue Blue 37

A system-defined color.

BlueViolet BlueViolet BlueViolet BlueViolet 38

A system-defined color.

Brown Brown Brown Brown 39

A system-defined color.

BurlyWood BurlyWood BurlyWood BurlyWood 40

A system-defined color.

ButtonFace ButtonFace ButtonFace ButtonFace 168

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

ButtonHighlight ButtonHighlight ButtonHighlight ButtonHighlight 169

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 ButtonShadow ButtonShadow ButtonShadow 170

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 CadetBlue CadetBlue CadetBlue 41

A system-defined color.

Chartreuse Chartreuse Chartreuse Chartreuse 42

A system-defined color.

Chocolate Chocolate Chocolate Chocolate 43

A system-defined color.

Control Control Control Control 5

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

ControlDark ControlDark ControlDark ControlDark 6

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 ControlDarkDark ControlDarkDark ControlDarkDark 7

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 ControlLight ControlLight ControlLight 8

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 ControlLightLight ControlLightLight ControlLightLight 9

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 ControlText ControlText ControlText 10

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

Coral Coral Coral Coral 44

A system-defined color.

CornflowerBlue CornflowerBlue CornflowerBlue CornflowerBlue 45

A system-defined color.

Cornsilk Cornsilk Cornsilk Cornsilk 46

A system-defined color.

Crimson Crimson Crimson Crimson 47

A system-defined color.

Cyan Cyan Cyan Cyan 48

A system-defined color.

DarkBlue DarkBlue DarkBlue DarkBlue 49

A system-defined color.

DarkCyan DarkCyan DarkCyan DarkCyan 50

A system-defined color.

DarkGoldenrod DarkGoldenrod DarkGoldenrod DarkGoldenrod 51

A system-defined color.

DarkGray DarkGray DarkGray DarkGray 52

A system-defined color.

DarkGreen DarkGreen DarkGreen DarkGreen 53

A system-defined color.

DarkKhaki DarkKhaki DarkKhaki DarkKhaki 54

A system-defined color.

DarkMagenta DarkMagenta DarkMagenta DarkMagenta 55

A system-defined color.

DarkOliveGreen DarkOliveGreen DarkOliveGreen DarkOliveGreen 56

A system-defined color.

DarkOrange DarkOrange DarkOrange DarkOrange 57

A system-defined color.

DarkOrchid DarkOrchid DarkOrchid DarkOrchid 58

A system-defined color.

DarkRed DarkRed DarkRed DarkRed 59

A system-defined color.

DarkSalmon DarkSalmon DarkSalmon DarkSalmon 60

A system-defined color.

DarkSeaGreen DarkSeaGreen DarkSeaGreen DarkSeaGreen 61

A system-defined color.

DarkSlateBlue DarkSlateBlue DarkSlateBlue DarkSlateBlue 62

A system-defined color.

DarkSlateGray DarkSlateGray DarkSlateGray DarkSlateGray 63

A system-defined color.

DarkTurquoise DarkTurquoise DarkTurquoise DarkTurquoise 64

A system-defined color.

DarkViolet DarkViolet DarkViolet DarkViolet 65

A system-defined color.

DeepPink DeepPink DeepPink DeepPink 66

A system-defined color.

DeepSkyBlue DeepSkyBlue DeepSkyBlue DeepSkyBlue 67

A system-defined color.

Desktop Desktop Desktop Desktop 11

The system-defined color of the desktop.

DimGray DimGray DimGray DimGray 68

A system-defined color.

DodgerBlue DodgerBlue DodgerBlue DodgerBlue 69

A system-defined color.

Firebrick Firebrick Firebrick Firebrick 70

A system-defined color.

FloralWhite FloralWhite FloralWhite FloralWhite 71

A system-defined color.

ForestGreen ForestGreen ForestGreen ForestGreen 72

A system-defined color.

Fuchsia Fuchsia Fuchsia Fuchsia 73

A system-defined color.

Gainsboro Gainsboro Gainsboro Gainsboro 74

A system-defined color.

GhostWhite GhostWhite GhostWhite GhostWhite 75

A system-defined color.

Gold Gold Gold Gold 76

A system-defined color.

Goldenrod Goldenrod Goldenrod Goldenrod 77

A system-defined color.

GradientActiveCaption GradientActiveCaption GradientActiveCaption GradientActiveCaption 171

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

GradientInactiveCaption GradientInactiveCaption GradientInactiveCaption GradientInactiveCaption 172

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

Gray Gray Gray Gray 78

A system-defined color.

GrayText GrayText GrayText GrayText 12

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

Green Green Green Green 79

A system-defined color.

GreenYellow GreenYellow GreenYellow GreenYellow 80

A system-defined color.

Highlight Highlight Highlight Highlight 13

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

HighlightText HighlightText HighlightText HighlightText 14

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

Honeydew Honeydew Honeydew Honeydew 81

A system-defined color.

HotPink HotPink HotPink HotPink 82

A system-defined color.

HotTrack HotTrack HotTrack HotTrack 15

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

InactiveBorder InactiveBorder InactiveBorder InactiveBorder 16

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

InactiveCaption InactiveCaption InactiveCaption InactiveCaption 17

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

InactiveCaptionText InactiveCaptionText InactiveCaptionText InactiveCaptionText 18

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

IndianRed IndianRed IndianRed IndianRed 83

A system-defined color.

Indigo Indigo Indigo Indigo 84

A system-defined color.

Info Info Info Info 19

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

InfoText InfoText InfoText InfoText 20

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

Ivory Ivory Ivory Ivory 85

A system-defined color.

Khaki Khaki Khaki Khaki 86

A system-defined color.

Lavender Lavender Lavender Lavender 87

A system-defined color.

LavenderBlush LavenderBlush LavenderBlush LavenderBlush 88

A system-defined color.

LawnGreen LawnGreen LawnGreen LawnGreen 89

A system-defined color.

LemonChiffon LemonChiffon LemonChiffon LemonChiffon 90

A system-defined color.

LightBlue LightBlue LightBlue LightBlue 91

A system-defined color.

LightCoral LightCoral LightCoral LightCoral 92

A system-defined color.

LightCyan LightCyan LightCyan LightCyan 93

A system-defined color.

LightGoldenrodYellow LightGoldenrodYellow LightGoldenrodYellow LightGoldenrodYellow 94

A system-defined color.

LightGray LightGray LightGray LightGray 95

A system-defined color.

LightGreen LightGreen LightGreen LightGreen 96

A system-defined color.

LightPink LightPink LightPink LightPink 97

A system-defined color.

LightSalmon LightSalmon LightSalmon LightSalmon 98

A system-defined color.

LightSeaGreen LightSeaGreen LightSeaGreen LightSeaGreen 99

A system-defined color.

LightSkyBlue LightSkyBlue LightSkyBlue LightSkyBlue 100

A system-defined color.

LightSlateGray LightSlateGray LightSlateGray LightSlateGray 101

A system-defined color.

LightSteelBlue LightSteelBlue LightSteelBlue LightSteelBlue 102

A system-defined color.

LightYellow LightYellow LightYellow LightYellow 103

A system-defined color.

Lime Lime Lime Lime 104

A system-defined color.

LimeGreen LimeGreen LimeGreen LimeGreen 105

A system-defined color.

Linen Linen Linen Linen 106

A system-defined color.

Magenta Magenta Magenta Magenta 107

A system-defined color.

Maroon Maroon Maroon Maroon 108

A system-defined color.

MediumAquamarine MediumAquamarine MediumAquamarine MediumAquamarine 109

A system-defined color.

MediumBlue MediumBlue MediumBlue MediumBlue 110

A system-defined color.

MediumOrchid MediumOrchid MediumOrchid MediumOrchid 111

A system-defined color.

MediumPurple MediumPurple MediumPurple MediumPurple 112

A system-defined color.

MediumSeaGreen MediumSeaGreen MediumSeaGreen MediumSeaGreen 113

A system-defined color.

MediumSlateBlue MediumSlateBlue MediumSlateBlue MediumSlateBlue 114

A system-defined color.

MediumSpringGreen MediumSpringGreen MediumSpringGreen MediumSpringGreen 115

A system-defined color.

MediumTurquoise MediumTurquoise MediumTurquoise MediumTurquoise 116

A system-defined color.

MediumVioletRed MediumVioletRed MediumVioletRed MediumVioletRed 117

A system-defined color.

Menu Menu Menu Menu 21

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

MenuBar MenuBar MenuBar MenuBar 173

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

MenuHighlight MenuHighlight MenuHighlight MenuHighlight 174

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

MenuText MenuText MenuText MenuText 22

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

MidnightBlue MidnightBlue MidnightBlue MidnightBlue 118

A system-defined color.

MintCream MintCream MintCream MintCream 119

A system-defined color.

MistyRose MistyRose MistyRose MistyRose 120

A system-defined color.

Moccasin Moccasin Moccasin Moccasin 121

A system-defined color.

NavajoWhite NavajoWhite NavajoWhite NavajoWhite 122

A system-defined color.

Navy Navy Navy Navy 123

A system-defined color.

OldLace OldLace OldLace OldLace 124

A system-defined color.

Olive Olive Olive Olive 125

A system-defined color.

OliveDrab OliveDrab OliveDrab OliveDrab 126

A system-defined color.

Orange Orange Orange Orange 127

A system-defined color.

OrangeRed OrangeRed OrangeRed OrangeRed 128

A system-defined color.

Orchid Orchid Orchid Orchid 129

A system-defined color.

PaleGoldenrod PaleGoldenrod PaleGoldenrod PaleGoldenrod 130

A system-defined color.

PaleGreen PaleGreen PaleGreen PaleGreen 131

A system-defined color.

PaleTurquoise PaleTurquoise PaleTurquoise PaleTurquoise 132

A system-defined color.

PaleVioletRed PaleVioletRed PaleVioletRed PaleVioletRed 133

A system-defined color.

PapayaWhip PapayaWhip PapayaWhip PapayaWhip 134

A system-defined color.

PeachPuff PeachPuff PeachPuff PeachPuff 135

A system-defined color.

Peru Peru Peru Peru 136

A system-defined color.

Pink Pink Pink Pink 137

A system-defined color.

Plum Plum Plum Plum 138

A system-defined color.

PowderBlue PowderBlue PowderBlue PowderBlue 139

A system-defined color.

Purple Purple Purple Purple 140

A system-defined color.

Red Red Red Red 141

A system-defined color.

RosyBrown RosyBrown RosyBrown RosyBrown 142

A system-defined color.

RoyalBlue RoyalBlue RoyalBlue RoyalBlue 143

A system-defined color.

SaddleBrown SaddleBrown SaddleBrown SaddleBrown 144

A system-defined color.

Salmon Salmon Salmon Salmon 145

A system-defined color.

SandyBrown SandyBrown SandyBrown SandyBrown 146

A system-defined color.

ScrollBar ScrollBar ScrollBar ScrollBar 23

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

SeaGreen SeaGreen SeaGreen SeaGreen 147

A system-defined color.

SeaShell SeaShell SeaShell SeaShell 148

A system-defined color.

Sienna Sienna Sienna Sienna 149

A system-defined color.

Silver Silver Silver Silver 150

A system-defined color.

SkyBlue SkyBlue SkyBlue SkyBlue 151

A system-defined color.

SlateBlue SlateBlue SlateBlue SlateBlue 152

A system-defined color.

SlateGray SlateGray SlateGray SlateGray 153

A system-defined color.

Snow Snow Snow Snow 154

A system-defined color.

SpringGreen SpringGreen SpringGreen SpringGreen 155

A system-defined color.

SteelBlue SteelBlue SteelBlue SteelBlue 156

A system-defined color.

Tan Tan Tan Tan 157

A system-defined color.

Teal Teal Teal Teal 158

A system-defined color.

Thistle Thistle Thistle Thistle 159

A system-defined color.

Tomato Tomato Tomato Tomato 160

A system-defined color.

Transparent Transparent Transparent Transparent 27

A system-defined color.

Turquoise Turquoise Turquoise Turquoise 161

A system-defined color.

Violet Violet Violet Violet 162

A system-defined color.

Wheat Wheat Wheat Wheat 163

A system-defined color.

White White White White 164

A system-defined color.

WhiteSmoke WhiteSmoke WhiteSmoke WhiteSmoke 165

A system-defined color.

Window Window Window Window 24

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

WindowFrame WindowFrame WindowFrame WindowFrame 25

The system-defined color of a window frame.

WindowText WindowText WindowText WindowText 26

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

Yellow Yellow Yellow Yellow 166

A system-defined color.

YellowGreen YellowGreen YellowGreen YellowGreen 167

A system-defined color.

Examples

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 = System::Drawing::Size( 650, 550 );

      // Get all the values from the KnownColor enumeration.
      System::Array^ colorsArray = Enum::GetValues( KnownColor::typeid );
      array<KnownColor>^allColors = gcnew array<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 = gcnew SolidBrush( Color::FromName( allColors[ i ].ToString() ) );
         e->Graphics->DrawString( allColors[ i ].ToString(), this->Font, aBrush, x, y );

         // Dispose of the custom brush.
         delete aBrush;
      }
   }
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();
    }

}
Private Sub DisplayKnownColors(ByVal e As PaintEventArgs)
    Me.Size = New Size(650, 550)
    Dim i As Integer

    ' Get all the values from the KnownColor enumeration.
    Dim colorsArray As System.Array = _
        [Enum].GetValues(GetType(KnownColor))
    Dim allColors(colorsArray.length) As KnownColor

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

    ' Loop through printing out the value's name in the colors 
    ' they represent.
    Dim y As Single
    Dim x As Single = 10.0F

    For i = 0 To allColors.Length - 1

        ' If x is a multiple of 30, start a new column.
        If (i > 0 And i Mod 30 = 0) Then
            x += 105.0F
            y = 15.0F
        Else
            ' Otherwise increment y by 15.
            y += 15.0F
        End If

        ' Create a custom brush from the color and use it to draw
        ' the brush's name.
        Dim aBrush As New SolidBrush(Color.FromName( _
            allColors(i).ToString()))
        e.Graphics.DrawString(allColors(i).ToString(), _
            Me.Font, aBrush, x, y)

        ' Dispose of the custom brush.
        aBrush.Dispose()
    Next

End Sub

Applies to