.NET Framework クラス ライブラリ
KnownColor 列挙体

既知のシステム カラーを指定します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)

構文

Visual Basic (宣言)
Public Enumeration KnownColor
Visual Basic (使用法)
Dim instance As KnownColor
C#
public enum KnownColor
C++
public enum class KnownColor
J#
public enum KnownColor
JScript
public enum KnownColor
メンバ

 メンバ名説明
ActiveBorderアクティブなウィンドウの境界線のシステム定義色。 
ActiveCaptionアクティブなウィンドウのタイトル バーの背景のシステム定義色。 
ActiveCaptionTextアクティブなウィンドウのタイトル バーのテキストのシステム定義色。 
AliceBlueシステム定義色。 
AntiqueWhiteシステム定義色。 
AppWorkspaceアプリケーション作業領域のシステム定義色。アプリケーション作業領域とは、ドキュメントで使用されていないマルチ ドキュメント ビューの領域のことです。 
Aquaシステム定義色。 
Aquamarineシステム定義色。 
Azureシステム定義色。 
Beigeシステム定義色。 
Bisqueシステム定義色。 
Blackシステム定義色。 
BlanchedAlmondシステム定義色。 
Blueシステム定義色。 
BlueVioletシステム定義色。 
Brownシステム定義色。 
BurlyWoodシステム定義色。 
ButtonFace3D 要素の表面のシステム定義色。 
ButtonHighlight3D 要素の強調表示カラーを表すシステム定義色。この色が、光源に面している 3D 要素の部分に適用されます。 
ButtonShadow3D 要素の影の色を表すシステム定義色。この色は、光源の反対側にある 3D 要素の部分に適用されます。 
CadetBlueシステム定義色。 
Chartreuseシステム定義色。 
Chocolateシステム定義色。 
Control3D 要素の表面のシステム定義色。 
ControlDark3D 要素の影のシステム定義色。影の色は、光源の反対側にある 3D 要素に部分的に適用されます。 
ControlDarkDark3D 要素の暗い影の色を表すシステム定義色。暗い影の色が、最も暗い色の 3D 要素の部分に適用されます。 
ControlLight3D 要素の明るい色を表すシステム定義色。明るい色が、光源に面している 3D 要素の部分に適用されます。 
ControlLightLight3D 要素の強調表示のシステム定義色。強調表示カラーが、最も明るい色の 3D 要素の部分に適用されます。 
ControlText3D 要素のテキストのシステム定義色。 
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 メソッドを呼び出し、ePaintEventArgs として渡します。

Visual Basic
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
C#
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();
    }

}
C++
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;
      }
   }
J#
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
参照

タグ :


Page view tracker