Assembly : System.Drawing (dans system.drawing.dll)
SyntaxePublic NotInheritable Class SystemBrushes
Dim instance As SystemBrushes
public sealed class SystemBrushes
public ref class SystemBrushes sealed
public final class SystemBrushes
public final class SystemBrushes
ExempleL'exemple de code suivant illustre comment définir un raccourci clavier à l'aide de la propriété HotkeyPrefix. Il montre également comment utiliser la méthode FromSystemColor. Pour exécuter cet exemple, collez le code dans un formulaire, gérez l'événement Paint du formulaire et appelez la méthode suivante, en passant l'argument e comme 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
Sécurité des threads
Plates-formesWindows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition
Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.
Outils (masquer)
S'enregistrer
Liste des Membres
Qui est en ligne?
FAQ