KnownColor Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the known system colors.
public enum class KnownColor
public enum KnownColor
type KnownColor =
Public Enum KnownColor
- Inheritance
Fields
Name | Value | Description |
---|---|---|
ActiveBorder | 1 | The system-defined color of the active window's border. |
ActiveCaption | 2 | The system-defined color of the background of the active window's title bar. |
ActiveCaptionText | 3 | The system-defined color of the text in the active window's title bar. |
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. |
Control | 5 | The system-defined face color of a 3-D element. |
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 | 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 | 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 | 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 | 10 | The system-defined color of text in a 3-D element. |
Desktop | 11 | The system-defined color of the desktop. |
GrayText | 12 | The system-defined color of dimmed text. Items in a list that are disabled are displayed in dimmed text. |
Highlight | 13 | The system-defined color of the background of selected items. This includes selected menu items as well as selected text. |
HighlightText | 14 | The system-defined color of the text of selected items. |
HotTrack | 15 | The system-defined color used to designate a hot-tracked item. Single-clicking a hot-tracked item executes the item. |
InactiveBorder | 16 | The system-defined color of an inactive window's border. |
InactiveCaption | 17 | The system-defined color of the background of an inactive window's title bar. |
InactiveCaptionText | 18 | The system-defined color of the text in an inactive window's title bar. |
Info | 19 | The system-defined color of the background of a ToolTip. |
InfoText | 20 | The system-defined color of the text of a ToolTip. |
Menu | 21 | The system-defined color of a menu's background. |
MenuText | 22 | The system-defined color of a menu's text. |
ScrollBar | 23 | The system-defined color of the background of a scroll bar. |
Window | 24 | The system-defined color of the background in the client area of a window. |
WindowFrame | 25 | The system-defined color of a window frame. |
WindowText | 26 | The system-defined color of the text in the client area of a window. |
Transparent | 27 | A system-defined color. |
AliceBlue | 28 | A system-defined color. |
AntiqueWhite | 29 | A system-defined color. |
Aqua | 30 | A system-defined color. |
Aquamarine | 31 | A system-defined color. |
Azure | 32 | A system-defined color. |
Beige | 33 | A system-defined color. |
Bisque | 34 | A system-defined color. |
Black | 35 | A system-defined color. |
BlanchedAlmond | 36 | A system-defined color. |
Blue | 37 | A system-defined color. |
BlueViolet | 38 | A system-defined color. |
Brown | 39 | A system-defined color. |
BurlyWood | 40 | A system-defined color. |
CadetBlue | 41 | A system-defined color. |
Chartreuse | 42 | A system-defined color. |
Chocolate | 43 | A system-defined color. |
Coral | 44 | A system-defined color. |
CornflowerBlue | 45 | A system-defined color. |
Cornsilk | 46 | A system-defined color. |
Crimson | 47 | A system-defined color. |
Cyan | 48 | A system-defined color. |
DarkBlue | 49 | A system-defined color. |
DarkCyan | 50 | A system-defined color. |
DarkGoldenrod | 51 | A system-defined color. |
DarkGray | 52 | A system-defined color. |
DarkGreen | 53 | A system-defined color. |
DarkKhaki | 54 | A system-defined color. |
DarkMagenta | 55 | A system-defined color. |
DarkOliveGreen | 56 | A system-defined color. |
DarkOrange | 57 | A system-defined color. |
DarkOrchid | 58 | A system-defined color. |
DarkRed | 59 | A system-defined color. |
DarkSalmon | 60 | A system-defined color. |
DarkSeaGreen | 61 | A system-defined color. |
DarkSlateBlue | 62 | A system-defined color. |
DarkSlateGray | 63 | A system-defined color. |
DarkTurquoise | 64 | A system-defined color. |
DarkViolet | 65 | A system-defined color. |
DeepPink | 66 | A system-defined color. |
DeepSkyBlue | 67 | A system-defined color. |
DimGray | 68 | A system-defined color. |
DodgerBlue | 69 | A system-defined color. |
Firebrick | 70 | A system-defined color. |
FloralWhite | 71 | A system-defined color. |
ForestGreen | 72 | A system-defined color. |
Fuchsia | 73 | A system-defined color. |
Gainsboro | 74 | A system-defined color. |
GhostWhite | 75 | A system-defined color. |
Gold | 76 | A system-defined color. |
Goldenrod | 77 | A system-defined color. |
Gray | 78 | A system-defined color. |
Green | 79 | A system-defined color. |
GreenYellow | 80 | A system-defined color. |
Honeydew | 81 | A system-defined color. |
HotPink | 82 | A system-defined color. |
IndianRed | 83 | A system-defined color. |
Indigo | 84 | A system-defined color. |
Ivory | 85 | A system-defined color. |
Khaki | 86 | A system-defined color. |
Lavender | 87 | A system-defined color. |
LavenderBlush | 88 | A system-defined color. |
LawnGreen | 89 | A system-defined color. |
LemonChiffon | 90 | A system-defined color. |
LightBlue | 91 | A system-defined color. |
LightCoral | 92 | A system-defined color. |
LightCyan | 93 | A system-defined color. |
LightGoldenrodYellow | 94 | A system-defined color. |
LightGray | 95 | A system-defined color. |
LightGreen | 96 | A system-defined color. |
LightPink | 97 | A system-defined color. |
LightSalmon | 98 | A system-defined color. |
LightSeaGreen | 99 | A system-defined color. |
LightSkyBlue | 100 | A system-defined color. |
LightSlateGray | 101 | A system-defined color. |
LightSteelBlue | 102 | A system-defined color. |
LightYellow | 103 | A system-defined color. |
Lime | 104 | A system-defined color. |
LimeGreen | 105 | A system-defined color. |
Linen | 106 | A system-defined color. |
Magenta | 107 | A system-defined color. |
Maroon | 108 | A system-defined color. |
MediumAquamarine | 109 | A system-defined color. |
MediumBlue | 110 | A system-defined color. |
MediumOrchid | 111 | A system-defined color. |
MediumPurple | 112 | A system-defined color. |
MediumSeaGreen | 113 | A system-defined color. |
MediumSlateBlue | 114 | A system-defined color. |
MediumSpringGreen | 115 | A system-defined color. |
MediumTurquoise | 116 | A system-defined color. |
MediumVioletRed | 117 | A system-defined color. |
MidnightBlue | 118 | A system-defined color. |
MintCream | 119 | A system-defined color. |
MistyRose | 120 | A system-defined color. |
Moccasin | 121 | A system-defined color. |
NavajoWhite | 122 | A system-defined color. |
Navy | 123 | A system-defined color. |
OldLace | 124 | A system-defined color. |
Olive | 125 | A system-defined color. |
OliveDrab | 126 | A system-defined color. |
Orange | 127 | A system-defined color. |
OrangeRed | 128 | A system-defined color. |
Orchid | 129 | A system-defined color. |
PaleGoldenrod | 130 | A system-defined color. |
PaleGreen | 131 | A system-defined color. |
PaleTurquoise | 132 | A system-defined color. |
PaleVioletRed | 133 | A system-defined color. |
PapayaWhip | 134 | A system-defined color. |
PeachPuff | 135 | A system-defined color. |
Peru | 136 | A system-defined color. |
Pink | 137 | A system-defined color. |
Plum | 138 | A system-defined color. |
PowderBlue | 139 | A system-defined color. |
Purple | 140 | A system-defined color. |
Red | 141 | A system-defined color. |
RosyBrown | 142 | A system-defined color. |
RoyalBlue | 143 | A system-defined color. |
SaddleBrown | 144 | A system-defined color. |
Salmon | 145 | A system-defined color. |
SandyBrown | 146 | A system-defined color. |
SeaGreen | 147 | A system-defined color. |
SeaShell | 148 | A system-defined color. |
Sienna | 149 | A system-defined color. |
Silver | 150 | A system-defined color. |
SkyBlue | 151 | A system-defined color. |
SlateBlue | 152 | A system-defined color. |
SlateGray | 153 | A system-defined color. |
Snow | 154 | A system-defined color. |
SpringGreen | 155 | A system-defined color. |
SteelBlue | 156 | A system-defined color. |
Tan | 157 | A system-defined color. |
Teal | 158 | A system-defined color. |
Thistle | 159 | A system-defined color. |
Tomato | 160 | A system-defined color. |
Turquoise | 161 | A system-defined color. |
Violet | 162 | A system-defined color. |
Wheat | 163 | A system-defined color. |
White | 164 | A system-defined color. |
WhiteSmoke | 165 | A system-defined color. |
Yellow | 166 | A system-defined color. |
YellowGreen | 167 | A system-defined color. |
ButtonFace | 168 | The system-defined face color of a 3-D element. |
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 | 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. |
GradientActiveCaption | 171 | The system-defined color of the lightest color in the color gradient of an active window's title bar. |
GradientInactiveCaption | 172 | The system-defined color of the lightest color in the color gradient of an inactive window's title bar. |
MenuBar | 173 | The system-defined color of the background of a menu bar. |
MenuHighlight | 174 | The system-defined color used to highlight menu items when the menu appears as a flat menu. |
RebeccaPurple | 175 | A system-defined color representing the ARGB value |
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