Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
にMenustripアイテムがあり、それを押すとForm閉じます。ItemFormのショートカット キーを作成したいのですが、"ShorcutKey" 設定に のオプションがありません。それを行う方法はありますか? ショートカットキーである項目に表示する必要があります。MenuStripEscEscEscMenuStripEsc
Menustrip
Form
MenuStrip
これを行うとうまくいきません:
menuStripItem.ShortcutKeys = Keys.Escape;
これに対する直接的な解決策はないと思います. この回避策を使用できますShortcutKeyDisplayString. コードで設定します.
ShortcutKeyDisplayString
menuStripItem.ShortcutKeyDisplayString = "ESC";
KeyDownフォーム チェックのイベント内で、フォームESCが押されたかどうかを確認Close()します。
KeyDown
ESC
Close()