SystemBrushes 類別

定義

SystemBrushes 類別的每個屬性是 SolidBrush,其為 Windows 顯示項目的色彩。

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 並呼叫下列方法,並 e 傳遞為 PaintEventArgs

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

備註

注意

在 .NET 6 和更新版本中,只有 Windows 作業系統才支援包含此類型的 System.Drawing.Common 套件。 在跨平臺應用程式中使用此類型會導致編譯時期警告和運行時間例外狀況。 如需詳細資訊,請參閱 僅限 Windows 上支援的 System.Drawing.Common

屬性

ActiveBorder

取得 SolidBrush,這是使用中視窗框線的色彩。

ActiveCaption

取得 SolidBrush,其為使用中視窗標題列的背景色彩。

ActiveCaptionText

取得 SolidBrush,這是使用中視窗標題列之文字的色彩。

AppWorkspace

取得 SolidBrush,這是應用程式工作區的色彩。

ButtonFace

取得 SolidBrush,其為 3D 項目的表面色彩。

ButtonHighlight

取得 SolidBrush,其為 3D 項目的醒目提示色彩。

ButtonShadow

取得 SolidBrush,其為 3D 項目的陰影色彩。

Control

取得 SolidBrush,其為 3D 項目的表面色彩。

ControlDark

取得 SolidBrush,其為 3D 項目的陰影色彩。

ControlDarkDark

取得 SolidBrush,其為 3D 項目的深色陰影色彩。

ControlLight

取得 SolidBrush,其為 3D 項目的淺色色彩。

ControlLightLight

取得 SolidBrush,其為 3D 項目的醒目提示色彩。

ControlText

取得 SolidBrush,其為 3D 項目中文字的色彩。

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,其為視窗工作區中 (client area) 文字的色彩。

方法

FromSystemColor(Color)

從指定的 Brush 結構建立 Color

適用於