Does anyone know the best way to create hot keys for menu items in an mdi parent form programmatically Struggling a bit with this one.
For example, ctrl + n - fires an event.
Does anyone know the best way to create hot keys for menu items in an mdi parent form programmatically Struggling a bit with this one.
For example, ctrl + n - fires an event.
In that case...
Sachin Chugh
You can use this as well :
protected override bool ProcessCmdKey(ref Message msg, Keys keyData){
if (keyData == (Keys.Control | Keys.N))
{
...
}
return base.ProcessCmdKey(ref msg, keyData);
}
But for a menuItem the above might be the thing to do.
Rocky79
hi,
try this for your menuitem, it is in a menustripe:
this
.newCtrlNToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+N"; this.newCtrlNToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));