SystemBrushes 类 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
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 事件并调用以下方法,作为 ePaintEventArgs传递。
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 及更高版本中, System.Drawing.Common 包(包括此类型)仅在 Windows 操作系统上受支持。 在跨平台应用中使用此类型会导致编译时警告和运行时异常。 有关详细信息,请参阅 System.Drawing.Common 仅在 Windows 上受支持。
属性
方法
| FromSystemColor(Color) |