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

3D 項目的系統定義表面色彩。The system-defined face color of a 3-D element.

ButtonHighlight 169

系統定義的色彩,其為 3D 項目的反白色彩。The system-defined color that is the highlight color of a 3-D element. 這個色彩會套用至面對光源的 3D 項目部分。This color is applied to parts of a 3-D element that face the light source.

ButtonShadow 170

系統定義的色彩,其為 3D 項目的陰影色彩。The system-defined color that is the shadow color of a 3-D element. 這個色彩會套用至背對光源的 3D 項目部分。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

3D 項目的系統定義表面色彩。The system-defined face color of a 3-D element.

ControlDark 6

3D 項目的系統定義陰影色彩。The system-defined shadow color of a 3-D element. 陰影色彩會套用至背對光源的 3D 項目部分。The shadow color is applied to parts of a 3-D element that face away from the light source.

ControlDarkDark 7

系統定義的色彩,其為 3D 項目的深色陰影色彩。The system-defined color that is the dark shadow color of a 3-D element. 深色陰影色彩會套用至色彩最深的 3D 項目部分。The dark shadow color is applied to the parts of a 3-D element that are the darkest color.

ControlLight 8

系統定義的色彩,其為 3D 項目的淺色色彩。The system-defined color that is the light color of a 3-D element. 淺色色彩會套用至面對光源的 3D 項目部分。The light color is applied to parts of a 3-D element that face the light source.

ControlLightLight 9

3D 項目的系統定義反白色彩。The system-defined highlight color of a 3-D element. 反白色彩會套用至色彩最亮的 3D 項目部分。The highlight color is applied to the parts of a 3-D element that are the lightest color.

ControlText 10

3D 項目中文字的系統定義色彩。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

暗灰色之 (Dimmed) 文字的系統定義色彩。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

視窗工作區 (Client Area) 中背景的系統定義色彩。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 Forms 搭配使用。This example is designed to be used with Windows Forms. 建立表單, 並在其中貼上下列程式碼。Create a form and paste the following code into it. 在表單的Paint事件處理方法中呼叫e PaintEventArgs方法, 傳遞做為。 DisplayKnownColorsCall 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

適用於