开发者

c# menuStrip_ItemClicked

which event to use to get the menu strip item clicked?

I've tried the menuStrip_ItemClicked event of the menuStrip; but it fires only 开发者_运维百科on the top menus only ( like "File", "Edit", "Windows").

I want to catch the sub menu items clicked event.

Thanks.


If you are talking about WindowsForms and use VisualStudio:

Go to design of your menu, rigth click on menu item you want, select properties, in property grid select events tab, select Click or MenuClick (don't remember precisely) event and double click on it.

Done


I think you should hook to click event of each ToolStripMenuItem. It can be the done with the same event handler if you prefer to have logic for it in one function.


Every subitem has its own event for clicking. In the winforms designer, you can just double click on the correct item you want to let happen. It will create a saveButton_clicked event or whatever event you would like and you can specify the information for that specific action in the method.

You can even let the shortcut commands work like CTRL+S when assigning them in the designer of visual studio.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜