語言

KnownColor 列舉

定義

指定已知的系統色彩。

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

欄位

名稱 值 Description
ActiveBorder 1

系統定義的活動視窗邊框顏色。

ActiveCaption 2

系統定義的活動視窗標題列背景顏色。

ActiveCaptionText 3

活動視窗標題欄中系統定義的文字顏色。

AppWorkspace 4

應用程式工作區的系統定義顏色。 應用程式工作區是多文件檢視中未被文件佔用的區域。

Control 5

系統定義的3D元素臉部顏色。

ControlDark 6

系統定義的3D元素陰影顏色。 陰影顏色會施加在面向光源背向的3D元素部分。

ControlDarkDark 7

系統定義的顏色,即3D元素的暗影色。 深色陰影色會應用在3D元素中顏色最深的部分。

ControlLight 8

系統定義的顏色,即三維元素的光色。 光色會應用在面向光源的三維元素部分。

ControlLightLight 9

系統定義的 3D 元素高亮色。 高光色會套用在3D元素中顏色最淺的部分。

ControlText 10

系統定義的三維元素文字顏色。

Desktop 11

系統定義的桌面顏色。

GrayText 12

系統定義的暗淡文字顏色。 列表中被停用的項目會以調暗的文字顯示。

Highlight 13

系統定義的選取物品背景顏色。 這包括精選的菜單項目以及精選的文字。

HighlightText 14

系統定義的選取項目文字顏色。

HotTrack 15

系統定義的顏色用來標示熱追蹤項目。 單擊熱追蹤項目即可執行該項目。

InactiveBorder 16

系統定義的非啟用視窗邊框顏色。

InactiveCaption 17

系統定義的非活躍視窗標題列背景顏色。

InactiveCaptionText 18

系統定義的非活躍視窗標題欄文字顏色。

Info 19

工具提示背景的系統定義顏色。

InfoText 20

工具提示文字的系統定義顏色。

Menu 21

系統定義的選單背景顏色。

MenuText 22

系統定義的選單文字顏色。

ScrollBar 23

滾動條背景的系統定義顏色。

Window 24

視窗用戶端區域背景的系統定義顏色。

WindowFrame 25

窗框的系統定義顏色。

WindowText 26

視窗客戶端區域文字的系統定義顏色。

Transparent 27

系統定義的顏色。

AliceBlue 28

系統定義的顏色。

AntiqueWhite 29

系統定義的顏色。

Aqua 30

系統定義的顏色。

Aquamarine 31

系統定義的顏色。

Azure 32

系統定義的顏色。

Beige 33

系統定義的顏色。

Bisque 34

系統定義的顏色。

Black 35

系統定義的顏色。

BlanchedAlmond 36

系統定義的顏色。

Blue 37

系統定義的顏色。

BlueViolet 38

系統定義的顏色。

Brown 39

系統定義的顏色。

BurlyWood 40

系統定義的顏色。

CadetBlue 41

系統定義的顏色。

Chartreuse 42

系統定義的顏色。

Chocolate 43

系統定義的顏色。

Coral 44

系統定義的顏色。

CornflowerBlue 45

系統定義的顏色。

Cornsilk 46

系統定義的顏色。

Crimson 47

系統定義的顏色。

Cyan 48

系統定義的顏色。

DarkBlue 49

系統定義的顏色。

DarkCyan 50

系統定義的顏色。

DarkGoldenrod 51

系統定義的顏色。

DarkGray 52

系統定義的顏色。

DarkGreen 53

系統定義的顏色。

DarkKhaki 54

系統定義的顏色。

DarkMagenta 55

系統定義的顏色。

DarkOliveGreen 56

系統定義的顏色。

DarkOrange 57

系統定義的顏色。

DarkOrchid 58

系統定義的顏色。

DarkRed 59

系統定義的顏色。

DarkSalmon 60

系統定義的顏色。

DarkSeaGreen 61

系統定義的顏色。

DarkSlateBlue 62

系統定義的顏色。

DarkSlateGray 63

系統定義的顏色。

DarkTurquoise 64

系統定義的顏色。

DarkViolet 65

系統定義的顏色。

DeepPink 66

系統定義的顏色。

DeepSkyBlue 67

系統定義的顏色。

DimGray 68

系統定義的顏色。

DodgerBlue 69

系統定義的顏色。

Firebrick 70

系統定義的顏色。

FloralWhite 71

系統定義的顏色。

ForestGreen 72

系統定義的顏色。

Fuchsia 73

系統定義的顏色。

Gainsboro 74

系統定義的顏色。

GhostWhite 75

系統定義的顏色。

Gold 76

系統定義的顏色。

Goldenrod 77

系統定義的顏色。

Gray 78

系統定義的顏色。

Green 79

系統定義的顏色。

GreenYellow 80

系統定義的顏色。

Honeydew 81

系統定義的顏色。

HotPink 82

系統定義的顏色。

IndianRed 83

系統定義的顏色。

Indigo 84

系統定義的顏色。

Ivory 85

系統定義的顏色。

Khaki 86

系統定義的顏色。

Lavender 87

系統定義的顏色。

LavenderBlush 88

系統定義的顏色。

LawnGreen 89

系統定義的顏色。

LemonChiffon 90

系統定義的顏色。

LightBlue 91

系統定義的顏色。

LightCoral 92

系統定義的顏色。

LightCyan 93

系統定義的顏色。

LightGoldenrodYellow 94

系統定義的顏色。

LightGray 95

系統定義的顏色。

LightGreen 96

系統定義的顏色。

LightPink 97

系統定義的顏色。

LightSalmon 98

系統定義的顏色。

LightSeaGreen 99

系統定義的顏色。

LightSkyBlue 100

系統定義的顏色。

LightSlateGray 101

系統定義的顏色。

LightSteelBlue 102

系統定義的顏色。

LightYellow 103

系統定義的顏色。

Lime 104

系統定義的顏色。

LimeGreen 105

系統定義的顏色。

Linen 106

系統定義的顏色。

Magenta 107

系統定義的顏色。

Maroon 108

系統定義的顏色。

MediumAquamarine 109

系統定義的顏色。

MediumBlue 110

系統定義的顏色。

MediumOrchid 111

系統定義的顏色。

MediumPurple 112

系統定義的顏色。

MediumSeaGreen 113

系統定義的顏色。

MediumSlateBlue 114

系統定義的顏色。

MediumSpringGreen 115

系統定義的顏色。

MediumTurquoise 116

系統定義的顏色。

MediumVioletRed 117

系統定義的顏色。

MidnightBlue 118

系統定義的顏色。

MintCream 119

系統定義的顏色。

MistyRose 120

系統定義的顏色。

Moccasin 121

系統定義的顏色。

NavajoWhite 122

系統定義的顏色。

Navy 123

系統定義的顏色。

OldLace 124

系統定義的顏色。

Olive 125

系統定義的顏色。

OliveDrab 126

系統定義的顏色。

Orange 127

系統定義的顏色。

OrangeRed 128

系統定義的顏色。

Orchid 129

系統定義的顏色。

PaleGoldenrod 130

系統定義的顏色。

PaleGreen 131

系統定義的顏色。

PaleTurquoise 132

系統定義的顏色。

PaleVioletRed 133

系統定義的顏色。

PapayaWhip 134

系統定義的顏色。

PeachPuff 135

系統定義的顏色。

Peru 136

系統定義的顏色。

Pink 137

系統定義的顏色。

Plum 138

系統定義的顏色。

PowderBlue 139

系統定義的顏色。

Purple 140

系統定義的顏色。

Red 141

系統定義的顏色。

RosyBrown 142

系統定義的顏色。

RoyalBlue 143

系統定義的顏色。

SaddleBrown 144

系統定義的顏色。

Salmon 145

系統定義的顏色。

SandyBrown 146

系統定義的顏色。

SeaGreen 147

系統定義的顏色。

SeaShell 148

系統定義的顏色。

Sienna 149

系統定義的顏色。

Silver 150

系統定義的顏色。

SkyBlue 151

系統定義的顏色。

SlateBlue 152

系統定義的顏色。

SlateGray 153

系統定義的顏色。

Snow 154

系統定義的顏色。

SpringGreen 155

系統定義的顏色。

SteelBlue 156

系統定義的顏色。

Tan 157

系統定義的顏色。

Teal 158

系統定義的顏色。

Thistle 159

系統定義的顏色。

Tomato 160

系統定義的顏色。

Turquoise 161

系統定義的顏色。

Violet 162

系統定義的顏色。

Wheat 163

系統定義的顏色。

White 164

系統定義的顏色。

WhiteSmoke 165

系統定義的顏色。

Yellow 166

系統定義的顏色。

YellowGreen 167

系統定義的顏色。

ButtonFace 168

系統定義的3D元素臉部顏色。

ButtonHighlight 169

系統定義的顏色,即 3D 元素的高亮色。 這種顏色會應用在面向光源的三維元素部分。

ButtonShadow 170

系統定義的顏色,即3D元素的陰影色。 這種顏色會應用在面向光源以外的三維元素部分。

GradientActiveCaption 171

系統定義的活動視窗標題列色彩漸層中最淺的顏色。

GradientInactiveCaption 172

系統定義的非活動視窗標題欄色彩漸層中最淺顏色的顏色。

MenuBar 173

系統定義的選單列背景顏色。

MenuHighlight 174

系統定義的顏色用於在選單呈現平面選單時,標示選單項目。

RebeccaPurple 175

系統定義的顏色代表 ARGB 值 #663399。

範例

以下程式碼範例示範如何利用 KnownColor 列舉工具列印出所有值的名稱與顏色。 此範例設計用於 Windows 表單。 建立一個表單,然後把以下程式碼貼上去。 以該表單的事件處理方法呼叫該DisplayKnownColors方法,並通過為 Painte。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

適用於