StringFormat.HotkeyPrefix プロパティ
アセンブリ: System.Drawing (system.drawing.dll 内)

Dim instance As StringFormat Dim value As HotkeyPrefix value = instance.HotkeyPrefix instance.HotkeyPrefix = value
/** @property */ public HotkeyPrefix get_HotkeyPrefix () /** @property */ public void set_HotkeyPrefix (HotkeyPrefix value)
public function get HotkeyPrefix () : HotkeyPrefix public function set HotkeyPrefix (value : HotkeyPrefix)
StringFormat オブジェクトの HotkeyPrefix オブジェクト。

グラフィカル ユーザー インターフェイスでは、ホット キーとはある用語内の下線付きの文字を示し、キーボード上でその文字を押す (通常は Alt キーなどの別のキーと組み合わせて使用します) ことにより、該当する用語が表す機能がアクティブになります。

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

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からStringFormat.HotkeyPrefix プロパティを検索する場合は、下記のリンクをクリックしてください。

- StringFormat.HotkeyPrefix プロパティのページへのリンク