|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
F1 keydown for menuitemEach of my menuitem has a help topic. When user selects the menuitem
and press F1, it should pop up the help. However, how can I catch the F1 keydown event for the menuitem? There is no keydown event for the menuitem. One way you can do this is to override the form's WndProc and look for
WM_HELP. protected override void WndProc(ref Message m) { if (m.Msg == 0x53) //WM_HELP { if (this.filesToolStripMenuItem.Selected) { MessageBox.Show(string.Format("F1 pressed {0}", this.filesToolStripMenuItem.Name)); } else if (this.filesOpenToolStripMenuItem.Selected) { MessageBox.Show(string.Format("F1 pressed {0}", this.filesOpenToolStripMenuItem.Name)); } } base.WndProc(ref m); } ================ Clay Burch Syncfusion, Inc. Is this solution for MenuStrip? My form is still using menu.
Show quote On Apr 10, 4:38 am, "ClayB" <c***@syncfusion.com> wrote: > One way you can do this is to override the form's WndProc and look for > WM_HELP. > > protected override void WndProc(ref Message m) > { > if (m.Msg == 0x53) //WM_HELP > { > if (this.filesToolStripMenuItem.Selected) > { > MessageBox.Show(string.Format("F1 pressed {0}", > this.filesToolStripMenuItem.Name)); > } > else if (this.filesOpenToolStripMenuItem.Selected) > { > MessageBox.Show(string.Format("F1 pressed {0}", > this.filesOpenToolStripMenuItem.Name)); > } > } > base.WndProc(ref m); > } > > ================ > Clay Burch > Syncfusion, Inc. |
|||||||||||||||||||||||