c#-winform-three ways to open other forms-show (), set owner (), ShowDialog ()

Source: Internet
Author: User

Three ways to open other forms

Show-for example, login interface to the main page, directly display the main page, two forms do not affect each other

 Public Partial class Form1:form    {        public  Form1 ()        {            InitializeComponent ();        }         Private void button1_click (object  sender, EventArgs e)        {            new  Form2 ();            F2. Show ();        }    }
Show open new Form

Owner-for example, the "Replace" option in the text file, which does not close after opening the interface is also allowed to manipulate the main page (Li Yu lxc)

 Public Partial class Form1:form    {        public  Form1 ()        {            InitializeComponent ();        }         Private void button1_click (object  sender, EventArgs e)        {            new  Form2 ();              This ;            F2. Show ();        }    }
Owner opens a new form

ShowDialog-such as the "open" option in the text file, opening the interface without closing is not allowed operation of the main page (Lee brainstorming Lxc)

View Code

c#-winform-three ways to open other forms-show (), set owner (), ShowDialog ()

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.