Use a delegate to solve the bubble display of a child form calling the parent form

Source: Internet
Author: User

Why do we need to use the delegated solution?

Cause: 1. declare the main form object call (New frmmain () in other subforms (). c_nfiserver.showballoontip (100, "system prompt", value, tooltipicon. info);), two System Tray icons are generated. 2. Call a method. The method must be declared as a static method, but the form object cannot be called within the static method. Instance 1: frmmain. CS: Public Delegate void showballoontipdelegate (string value ); Public static showballoontipdelegate; Public frmmain () {initializecomponent (); c_nbcmian.groups.clear (); this. lookandfeel. skinname = loginmng. logininfo. person. personskin; _ formmng = new formmng (this, classname, loginmng. logininfo. person. personskin );   Showballoontipdelegate = showballoontipinfo; } Private void frmmain_load (Object sender, eventargs e) {frmwaiting. Show (this, true, "the interface is being initialized. Please wait! "); Creategroupmain (1); this. Text + =" v "+ application. productversion; OpenForm (" Homepage "," frmfirstinfo "," officeautomation. baseinfo. frmfirstinfo "); String value = "Welcome," + loginmng. logininfo. Person. personname + "! "; Showballoontipdelegate (value ); Frmwaiting. Hide (this);} private void showballoontipinfo (string value ){ C_nfiserver.showballoontip (100, "system prompt", value, tooltipicon. info ); } Other subform calls: String showinfo = "recharge complete! \ R \ n "; Frmmain. showballoontipdelegate (showinfo );

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.