KnownColor 枚举

定义

指定已知的系统颜色。Specifies the known system colors.

public enum class KnownColor
public enum KnownColor
type KnownColor = 
Public Enum KnownColor
继承
KnownColor

字段

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.

AliceBlue 28

系统定义的颜色。A system-defined color.

AntiqueWhite 29

系统定义的颜色。A system-defined color.

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

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.

CadetBlue 41

系统定义的颜色。A system-defined color.

Chartreuse 42

系统定义的颜色。A system-defined color.

Chocolate 43

系统定义的颜色。A system-defined color.

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.

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.

Desktop 11

桌面的系统定义颜色。The system-defined color of the desktop.

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.

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.

Gray 78

系统定义的颜色。A system-defined color.

GrayText 12

浅灰色文本的系统定义颜色。The system-defined color of dimmed text. 列表中已禁用的项用浅灰色文本显示。Items in a list that are disabled are displayed in dimmed text.

Green 79

系统定义的颜色。A system-defined color.

GreenYellow 80

系统定义的颜色。A system-defined color.

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.

Honeydew 81

系统定义的颜色。A system-defined color.

HotPink 82

系统定义的颜色。A system-defined color.

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.

IndianRed 83

系统定义的颜色。A system-defined color.

Indigo 84

系统定义的颜色。A system-defined color.

Info 19

工具提示背景的系统定义颜色。The system-defined color of the background of a ToolTip.

InfoText 20

工具提示文本的系统定义颜色。The system-defined color of the text of a ToolTip.

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.

Menu 21

菜单背景的系统定义颜色。The system-defined color of a menu's background.

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.

MenuText 22

菜单文本的系统定义颜色。The system-defined color of a menu's text.

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.

ScrollBar 23

滚动条背景的系统定义颜色。The system-defined color of the background of a scroll bar.

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.

Transparent 27

系统定义的颜色。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.

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.

Yellow 166

系统定义的颜色。A system-defined color.

YellowGreen 167

系统定义的颜色。A system-defined color.

示例

下面的代码示例演示如何使用KnownColor枚举输出其所有值的名称和颜色。The following code example demonstrates how to use the KnownColor enumeration to print out the names and colors of all its values. 此示例旨在与 Windows 窗体一起使用。This example is designed to be used with Windows Forms. 创建窗体并将以下代码粘贴到其中。Create a form and paste the following code into it. 在窗体的Paint事件处理方法中调用e PaintEventArgs方法,并DisplayKnownColors将作为传递。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

适用于