SystemBrushes クラス
アセンブリ: System.Drawing (system.drawing.dll 内)


HotkeyPrefix プロパティを使用して、ショートカット キーを設定する方法を次のコード例に示します。この例では、FromSystemColor メソッドの使用方法も示します。この例を実行するには、コードをフォームに貼り付けて、フォームの Paint イベントを処理し、PaintEventArgs の e を渡して次のメソッドを呼び出します。
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.Drawing.SystemBrushes


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- SystemBrushes クラスのページへのリンク