C # toolstrip. itemclicked event cannot respond to the solution of level 2 menu (sub menu)

Source: Internet
Author: User
/// <Summary> /// bind the RESPONSE event /// </Summary> This. listmenu. itemclicked + = new system. windows. forms. toolstripitemclickedeventhandler (this. listmenu_itemclicked ); /// <summary> /// right-click the itemmenu and choose </Summary> /// <Param name = "sender"> </param> // <Param name = "E"> </param> private void itemmenu_itemclicked (Object sender, toolstripitemclickedeventargs e) {// code ...}

However, itemmenu_itemclicked does not respond to the click events of level-2 menus, and does not want to add click events one by one. The following methods may help you:

Add the dropdownitemclicked event to the upper menu of the level-2 menu, for example:

 
This. copydetail. dropdownitemclicked + = new system. Windows. Forms. toolstripitemclickedeventhandler (copydetail_dropdownitemclicked );

Add a processing method as follows:

Void copydetail_dropdownitemclicked (Object sender, system. Windows. Forms. toolstripitemclickedeventargs e) {// code ...}

In this way, you can respond.

The same applies to multilevel menus.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.