既知のシステム カラーを指定します。
名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
Public Enumeration KnownColor
Dim instance As KnownColor
public enum class KnownColor
| | メンバ名 | 説明 |
|---|
| ActiveBorder | アクティブなウィンドウの境界線のシステム定義色。 |
| ActiveCaption | アクティブなウィンドウのタイトル バーの背景のシステム定義色。 |
| ActiveCaptionText | アクティブなウィンドウのタイトル バーのテキストのシステム定義色。 |
| AliceBlue | システム定義色。 |
| AntiqueWhite | システム定義色。 |
| AppWorkspace | アプリケーション作業領域のシステム定義色。アプリケーション作業領域とは、ドキュメントで使用されていないマルチ ドキュメント ビューの領域のことです。 |
| Aqua | システム定義色。 |
| Aquamarine | システム定義色。 |
| Azure | システム定義色。 |
| Beige | システム定義色。 |
| Bisque | システム定義色。 |
| Black | システム定義色。 |
| BlanchedAlmond | システム定義色。 |
| Blue | システム定義色。 |
| BlueViolet | システム定義色。 |
| Brown | システム定義色。 |
| BurlyWood | システム定義色。 |
| ButtonFace | 3D 要素の表面のシステム定義色。 |
| ButtonHighlight | 3D 要素の強調表示カラーを表すシステム定義色。この色が、光源に面している 3D 要素の部分に適用されます。 |
| ButtonShadow | 3D 要素の影の色を表すシステム定義色。この色は、光源の反対側にある 3D 要素の部分に適用されます。 |
| CadetBlue | システム定義色。 |
| Chartreuse | システム定義色。 |
| Chocolate | システム定義色。 |
| Control | 3D 要素の表面のシステム定義色。 |
| ControlDark | 3D 要素の影のシステム定義色。影の色は、光源の反対側にある 3D 要素に部分的に適用されます。 |
| ControlDarkDark | 3D 要素の暗い影の色を表すシステム定義色。暗い影の色が、最も暗い色の 3D 要素の部分に適用されます。 |
| ControlLight | 3D 要素の明るい色を表すシステム定義色。明るい色が、光源に面している 3D 要素の部分に適用されます。 |
| ControlLightLight | 3D 要素の強調表示のシステム定義色。強調表示カラーが、最も明るい色の 3D 要素の部分に適用されます。 |
| ControlText | 3D 要素のテキストのシステム定義色。 |
| Coral | システム定義色。 |
| CornflowerBlue | システム定義色。 |
| Cornsilk | システム定義色。 |
| Crimson | システム定義色。 |
| Cyan | システム定義色。 |
| DarkBlue | システム定義色。 |
| DarkCyan | システム定義色。 |
| DarkGoldenrod | システム定義色。 |
| DarkGray | システム定義色。 |
| DarkGreen | システム定義色。 |
| DarkKhaki | システム定義色。 |
| DarkMagenta | システム定義色。 |
| DarkOliveGreen | システム定義色。 |
| DarkOrange | システム定義色。 |
| DarkOrchid | システム定義色。 |
| DarkRed | システム定義色。 |
| DarkSalmon | システム定義色。 |
| DarkSeaGreen | システム定義色。 |
| DarkSlateBlue | システム定義色。 |
| DarkSlateGray | システム定義色。 |
| DarkTurquoise | システム定義色。 |
| DarkViolet | システム定義色。 |
| DeepPink | システム定義色。 |
| DeepSkyBlue | システム定義色。 |
| Desktop | デスクトップのシステム定義色。 |
| DimGray | システム定義色。 |
| DodgerBlue | システム定義色。 |
| Firebrick | システム定義色。 |
| FloralWhite | システム定義色。 |
| ForestGreen | システム定義色。 |
| Fuchsia | システム定義色。 |
| Gainsboro | システム定義色。 |
| GhostWhite | システム定義色。 |
| Gold | システム定義色。 |
| Goldenrod | システム定義色。 |
| GradientActiveCaption | アクティブなウィンドウのタイトル バーに適用される色のグラデーションにおいて最も明るい色のシステム定義色。 |
| GradientInactiveCaption | アクティブでないウィンドウのタイトル バーに適用される色のグラデーションにおいて最も明るい色のシステム定義色。 |
| Gray | システム定義色。 |
| GrayText | 淡色のテキストのシステム定義色。リスト内の無効の項目は、淡色のテキストで表示されます。 |
| Green | システム定義色。 |
| GreenYellow | システム定義色。 |
| Highlight | 選択した項目の背景のシステム定義色。これには、選択したメニュー項目と選択したテキストが必要です。 |
| HighlightText | 選択した項目のテキストのシステム定義色。 |
| Honeydew | システム定義色。 |
| HotPink | システム定義色。 |
| HotTrack | ホット トラッキング項目の指定に使用するシステム定義色。ホット トラッキング項目は、シングルクリックして実行します。 |
| InactiveBorder | アクティブでないウィンドウの境界線のシステム定義色。 |
| InactiveCaption | アクティブでないウィンドウのタイトル バーの背景のシステム定義色。 |
| InactiveCaptionText | アクティブでないウィンドウのタイトル バーのテキストのシステム定義色。 |
| IndianRed | システム定義色。 |
| Indigo | システム定義色。 |
| Info | ツールヒントの背景のシステム定義色。 |
| InfoText | ツールヒントのテキストのシステム定義色。 |
| Ivory | システム定義色。 |
| Khaki | システム定義色。 |
| Lavender | システム定義色。 |
| LavenderBlush | システム定義色。 |
| LawnGreen | システム定義色。 |
| LemonChiffon | システム定義色。 |
| LightBlue | システム定義色。 |
| LightCoral | システム定義色。 |
| LightCyan | システム定義色。 |
| LightGoldenrodYellow | システム定義色。 |
| LightGray | システム定義色。 |
| LightGreen | システム定義色。 |
| LightPink | システム定義色。 |
| LightSalmon | システム定義色。 |
| LightSeaGreen | システム定義色。 |
| LightSkyBlue | システム定義色。 |
| LightSlateGray | システム定義色。 |
| LightSteelBlue | システム定義色。 |
| LightYellow | システム定義色。 |
| Lime | システム定義色。 |
| LimeGreen | システム定義色。 |
| Linen | システム定義色。 |
| Magenta | システム定義色。 |
| Maroon | システム定義色。 |
| MediumAquamarine | システム定義色。 |
| MediumBlue | システム定義色。 |
| MediumOrchid | システム定義色。 |
| MediumPurple | システム定義色。 |
| MediumSeaGreen | システム定義色。 |
| MediumSlateBlue | システム定義色。 |
| MediumSpringGreen | システム定義色。 |
| MediumTurquoise | システム定義色。 |
| MediumVioletRed | システム定義色。 |
| Menu | メニューの背景のシステム定義色。 |
| MenuBar | メニュー バーの背景のシステム定義色。 |
| MenuHighlight | メニューをフラット メニューとして表示するときにメニュー項目の強調表示に使用されるシステム定義色。 |
| MenuText | メニューのテキストのシステム定義色。 |
| MidnightBlue | システム定義色。 |
| MintCream | システム定義色。 |
| MistyRose | システム定義色。 |
| Moccasin | システム定義色。 |
| NavajoWhite | システム定義色。 |
| Navy | システム定義色。 |
| OldLace | システム定義色。 |
| Olive | システム定義色。 |
| OliveDrab | システム定義色。 |
| Orange | システム定義色。 |
| OrangeRed | システム定義色。 |
| Orchid | システム定義色。 |
| PaleGoldenrod | システム定義色。 |
| PaleGreen | システム定義色。 |
| PaleTurquoise | システム定義色。 |
| PaleVioletRed | システム定義色。 |
| PapayaWhip | システム定義色。 |
| PeachPuff | システム定義色。 |
| Peru | システム定義色。 |
| Pink | システム定義色。 |
| Plum | システム定義色。 |
| PowderBlue | システム定義色。 |
| Purple | システム定義色。 |
| Red | システム定義色。 |
| RosyBrown | システム定義色。 |
| RoyalBlue | システム定義色。 |
| SaddleBrown | システム定義色。 |
| Salmon | システム定義色。 |
| SandyBrown | システム定義色。 |
| ScrollBar | スクロール バーの背景のシステム定義色。 |
| SeaGreen | システム定義色。 |
| SeaShell | システム定義色。 |
| Sienna | システム定義色。 |
| Silver | システム定義色。 |
| SkyBlue | システム定義色。 |
| SlateBlue | システム定義色。 |
| SlateGray | システム定義色。 |
| Snow | システム定義色。 |
| SpringGreen | システム定義色。 |
| SteelBlue | システム定義色。 |
| Tan | システム定義色。 |
| Teal | システム定義色。 |
| Thistle | システム定義色。 |
| Tomato | システム定義色。 |
| Transparent | システム定義色。 |
| Turquoise | システム定義色。 |
| Violet | システム定義色。 |
| Wheat | システム定義色。 |
| White | システム定義色。 |
| WhiteSmoke | システム定義色。 |
| Window | ウィンドウのクライアント領域の背景のシステム定義色。 |
| WindowFrame | ウィンドウ枠のシステム定義色。 |
| WindowText | ウィンドウのクライアント領域のテキストのシステム定義色。 |
| Yellow | システム定義色。 |
| YellowGreen | システム定義色。 |
KnownColor 列挙体を使用してすべての値の名前および色を印刷する方法を方法を次のコード例に示します。この例は、Windows フォームでの使用を意図してデザインされています。フォームを作成し、次のコードを貼り付けます。フォームの Paint イベント処理メソッドで DisplayKnownColors メソッドを呼び出し、e を PaintEventArgs として渡します。
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
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:
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.set_Size(new Size(650, 550));
// Get all the values from the KnownColor enumeration.
System.Array colorsArray = Enum.GetValues(KnownColor.class.ToType());
KnownColor allColors[] = new KnownColor[colorsArray.get_Length()];
Array.Copy(colorsArray, allColors, colorsArray.get_Length());
// Loop through printing out the values' names in the colors
// they represent.
float y = 0;
float x = 10;
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;
y = 15;
}
else {
// Otherwise, increment y by 15.
y += 15;
}
// Create a custom brush from the color and use it to draw
// the brush's name.
SolidBrush aBrush = new SolidBrush(Color.FromName(
allColors.get_Item(i).ToString()));
e.get_Graphics().DrawString(allColors.get_Item(i).ToString(),
this.get_Font(), aBrush, x, y);
// Dispose of the custom brush.
aBrush.Dispose();
}
} //DisplayKnownColors
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
.NET Framework
サポート対象 : 2.0、1.1、1.0