Actualización: noviembre 2007
Cada una de las propiedades de la clase SystemBrushes es una estructura SolidBrush que es el color de un elemento de presentación de Windows.
Espacio de nombres:
System.Drawing
Ensamblado:
System.Drawing (en System.Drawing.dll)
Visual Basic (Declaración)
Public NotInheritable Class SystemBrushes
Dim instance As SystemBrushes
public sealed class SystemBrushes
public ref class SystemBrushes sealed
public final class SystemBrushes
public final class SystemBrushes
En el ejemplo de código siguiente se muestra cómo establecer un método abreviado de teclado mediante la propiedad HotkeyPrefix. También se muestra cómo utilizar el método FromSystemColor. Para ejecutar este ejemplo, pegue el código en un formulario, controle el evento Paint del formulario y llame al método siguiente; por último, pase e como PaintEventArgs.
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
System..::.Object
System.Drawing..::.SystemBrushes
Seguridad para subprocesos
Todos los miembros static (Shared en Visual Basic) públicos de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
.NET Framework
Compatible con: 3.5, 3.0, 2.0, 1.1, 1.0
Referencia