SystemBrushes Class
.NET Framework 3.0
Each property of the SystemBrushes class is a SolidBrush that is the color of a Windows display element.
Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)
Assembly: System.Drawing (in system.drawing.dll)
The following code example shows how to set a keyboard shortcut using the HotkeyPrefix property. It also demonstrates how to use the FromSystemColor method. To run this example, paste the code into a form, handle the form's Paint event and call the following method, passing e as 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.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
Windows 98, Windows Server 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
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: