SystemBrushes クラス

定義

SystemBrushes クラスの各プロパティは、Windows の表示要素の色を表す SolidBrush です。

public ref class SystemBrushes abstract sealed
public ref class SystemBrushes sealed
public static class SystemBrushes
public sealed class SystemBrushes
type SystemBrushes = class
Public Class SystemBrushes
Public NotInheritable Class SystemBrushes
継承
SystemBrushes

次のコード例は、 プロパティを使用してキーボード ショートカットを設定する方法を HotkeyPrefix 示しています。 また、 メソッドの使用方法 FromSystemColor も示します。 この例を実行するには、コードをフォームに貼り付け、フォームのPaintイベントを処理し、 としてPaintEventArgs渡してe次のメソッドを呼び出します。

private:
   void ShowHotKey( PaintEventArgs^ e )
   {
      // Declare the string with a keyboard shortcut.
      String^ text = "&Click Here";

      // Declare a new StringFormat.
      StringFormat^ format = gcnew StringFormat;

      // Set the HotkeyPrefix property.
      format->HotkeyPrefix = System::Drawing::Text::HotkeyPrefix::Show;

      // Draw the string.
      Brush^ theBrush = SystemBrushes::FromSystemColor( SystemColors::Highlight );
      e->Graphics->DrawString( text, this->Font, theBrush, 30, 40, format );
   }
private void ShowHotKey(PaintEventArgs e)
{

    // Declare the string with a keyboard shortcut.
    string text = "&Click Here";

    // Declare a new StringFormat.
    StringFormat format = new StringFormat();

    // Set the HotkeyPrefix property.
    format.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Show;

    // Draw the string.
    Brush theBrush = 
        SystemBrushes.FromSystemColor(SystemColors.Highlight);

    e.Graphics.DrawString(text, this.Font, theBrush, 30, 40, format);
}
Private Sub ShowHotKey(ByVal e As PaintEventArgs)

    ' Declare the string with keyboard shortcut.
    Dim text As String = "&Click Here"

    ' Declare a new StringFormat.
    Dim format As New StringFormat

    ' Set the HotkeyPrefix property.
    format.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Show

    ' Draw the string.
    Dim theBrush As Brush = _
        SystemBrushes.FromSystemColor(SystemColors.Highlight)
    e.Graphics.DrawString(text, Me.Font, theBrush, 30, 40, format)
End Sub

注釈

Note

.NET 6 以降のバージョンでは、この種類を含む System.Drawing.Common パッケージは Windows オペレーティング システムでのみサポートされています。 クロスプラットフォーム アプリでこの型を使用すると、コンパイル時の警告と実行時の例外が発生します。 詳細については、「 Windows でのみサポートされる System.Drawing.Common」を参照してください。

プロパティ

ActiveBorder

アクティブなウィンドウの境界線の色である SolidBrush を取得します。

ActiveCaption

アクティブなウィンドウのタイトル バーの背景の色を表す SolidBrush を取得します。

ActiveCaptionText

アクティブなウィンドウのタイトル バーのテキストの色である SolidBrush を取得します。

AppWorkspace

アプリケーション ワークスペースの色である SolidBrush を取得します。

ButtonFace

3D 要素の表面の色を表す SolidBrush を取得します。

ButtonHighlight

3D 要素の強調表示色を表す SolidBrush を取得します。

ButtonShadow

3D 要素の影色を表す SolidBrush を取得します。

Control

3D 要素の表面の色を表す SolidBrush を取得します。

ControlDark

3D 要素の影色を表す SolidBrush を取得します。

ControlDarkDark

3D 要素の暗い影色を表す SolidBrush を取得します。

ControlLight

3D 要素の明るい色を表す SolidBrush を取得します。

ControlLightLight

3D 要素の強調表示色を表す SolidBrush を取得します。

ControlText

3D 要素のテキストの色を表す SolidBrush を取得します。

Desktop

デスクトップの色を表す SolidBrush を取得します。

GradientActiveCaption

アクティブなウィンドウのタイトル バーに適用される色のグラデーションにおいて最も明るい色を表す SolidBrush を取得します。

GradientInactiveCaption

アクティブでないウィンドウのタイトル バーに適用される色のグラデーションにおいて最も明るい色を表す SolidBrush を取得します。

GrayText

淡色表示になっているテキストの色を表す SolidBrush を取得します。

Highlight

選択した項目の背景の色を表す SolidBrush を取得します。

HighlightText

選択した項目のテキストの色である SolidBrush を取得します。

HotTrack

フォーカスされている項目の指定に使用する色である SolidBrush を取得します。

InactiveBorder

非アクティブなウィンドウの境界線の色である SolidBrush を取得します。

InactiveCaption

アクティブでないウィンドウのタイトル バーの背景の色を表す SolidBrush を取得します。

InactiveCaptionText

アクティブでないウィンドウのタイトル バーのテキストの色を表す SolidBrush を取得します。

Info

ツールヒントの背景の色を表す SolidBrush を取得します。

InfoText

ツールヒントのテキストの色を表す SolidBrush を取得します。

Menu

メニューの背景色である SolidBrush を取得します。

MenuBar

メニュー バーの背景の色を表す SolidBrush を取得します。

MenuHighlight

メニューをフラット メニューとして表示するときにメニュー項目の強調表示に使用される色を表す SolidBrush を取得します。

MenuText

メニューのテキストの色である SolidBrush を取得します。

ScrollBar

スクロール バーの背景の色を表す SolidBrush を取得します。

Window

ウィンドウのクライアント領域の背景の色を表す SolidBrush を取得します。

WindowFrame

ウィンドウの枠の色を表す SolidBrush を取得します。

WindowText

ウィンドウのクライアント領域のテキストの色を表す SolidBrush を取得します。

メソッド

FromSystemColor(Color)

指定した Brush 構造体から Color を作成します。

適用対象