イベント ハンドラが、このイベントに関連するデータを含む、KeyEventArgs 型の引数を受け取りました。次の KeyEventArgs プロパティには、このイベントの固有の情報が記載されます。
次のコードは ShortcutKeyDown イベントを発生させる方法を示します。この例では、 ShortcutKeyDown イベントと連携するイベント処理を呼び出します。
// Please use the following namespace
// using System.Windows.Forms;
// using GrapeCity.Win.Editors;
public void WireShortcutKeyDownEvent()
{
// Creates an instace of the GcShortcut component.
GcShortcut gcShortcut1 = new GcShortcut();
// Sets the shortcut keys.
gcShortcut1.ShortcutKeys.Add(Keys.E | Keys.Control);
gcShortcut1.ShortcutKeyDown += new KeyEventHandler(OnGcShortcutShortcutKeyDown);
}
private void OnGcShortcutShortcutKeyDown(object sender, KeyEventArgs e)
{
// Displays a message box.
MessageBox.Show("Ctrl + E");
// Quit event handling.
e.Handled = true;
}
' Please use the following namespace
' Imports System.Windows.Forms;
' Imports GrapeCity.Win.Editors;
Public Sub WireShortcutKeyDownEvent()
' Creates an instace of the GcShortcut component.
Dim gcShortcut1 As New GcShortcut()
' Sets the shortcut keys.
gcShortcut1.ShortcutKeys.Add(Keys.E Or Keys.Control)
AddHandler gcShortcut1.ShortcutKeyDown, AddressOf OnGcShortcutShortcutKeyDown
End Sub
Private Sub OnGcShortcutShortcutKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
' Displays a message box.
MessageBox.Show("Ctrl + E")
' Quit event handling.
e.Handled = True
End Sub