Freigeben über


SystemBrushes-Klasse

Jede Eigenschaft der SystemBrushes-Klasse ist ein SolidBrush mit der Farbe eines Windows-Anzeigeelements.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

Syntax

'Declaration
Public NotInheritable Class SystemBrushes
'Usage
Dim instance As SystemBrushes
public sealed class SystemBrushes
public ref class SystemBrushes sealed
public final class SystemBrushes
public final class SystemBrushes

Beispiel

Im folgenden Codebeispiel wird veranschaulicht, wie mit der HotkeyPrefix-Eigenschaft eine Tastenkombination festgelegt wird. Darüber hinaus wird die Verwendung der FromSystemColor-Methode veranschaulicht. Fügen Sie zum Ausführen dieses Beispiels den Code in ein Formular ein, behandeln Sie das Paint-Ereignis des Formulars, und rufen Sie die folgende Methode auf, wobei Sie e als PaintEventArgs übergeben.

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
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:
   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.set_HotkeyPrefix(System.Drawing.Text.HotkeyPrefix.Show);

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

    e.get_Graphics().DrawString(text, this.get_Font(), theBrush, 30, 40, 
        format);
} //ShowHotKey

Vererbungshierarchie

System.Object
  System.Drawing.SystemBrushes

Threadsicherheit

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Plattformen

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 unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

SystemBrushes-Member
System.Drawing-Namespace