StringFormat.HotkeyPrefix Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee wordt het HotkeyPrefix object voor dit StringFormat object opgehaald of ingesteld.
public:
property System::Drawing::Text::HotkeyPrefix HotkeyPrefix { System::Drawing::Text::HotkeyPrefix get(); void set(System::Drawing::Text::HotkeyPrefix value); };
public System.Drawing.Text.HotkeyPrefix HotkeyPrefix { get; set; }
member this.HotkeyPrefix : System.Drawing.Text.HotkeyPrefix with get, set
Public Property HotkeyPrefix As HotkeyPrefix
Waarde van eigenschap
Het HotkeyPrefix object voor dit StringFormat object is de standaardwaarde None.
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u een sneltoets instelt met behulp van de HotkeyPrefix eigenschap. Het laat ook zien hoe u de FromSystemColor methode gebruikt. Als u dit voorbeeld wilt uitvoeren, plakt u de code in een formulier, verwerkt u de gebeurtenis van Paint het formulier en roept u de volgende methode aan, waarbij u e doorgeeft als PaintEventArgs.
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.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 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
Opmerkingen
In een grafische gebruikersinterface is een sneltoets de onderstreepte letter in een woord (meestal gecombineerd met een andere toets, zoals de Alt-toets) die u op het toetsenbord kunt drukken om de functionaliteit van het woord te activeren.