form to add controls to the form to show and hide

Source: Internet
Author: User

For an application, controls are the building blocks of the user interface, and they have interactive features

Ways to add controls: dragging, pulling, dragging

another way to add a control: that is , the add method of the controls class of the form, in the following format

the flag for the form . Controls.Add(control identifier)

Example:

Create an mybut an object

B Utton mybut=new button ();

Modify the text name for mybut

M ybut.text= " 51zxw " ;

adding controls to mybut

T His.controls.add (mybut);

forms are displayed and hidden through the show method and The Hide method, in the following format

The form identifier . Show

The form identifier . Hide

Example:

If there are 2 form in a program , I will pop up by clicking Form1 Form2

in the editor , select the click Event on the Form1 and double-click to enter Form1_Click

F orm2 myform2=new Form2(); // instantiate for Form2

M yform2.show(); // display Form2

private void Form1_Click (object sender, EventArgs e)        {            //For Form1 add click event, if you want to click on the button to jump to write            in Button_Click Form2 Myform2 = new Form2 ();            Myform2. Show ();        }        private void Button1_Click (object sender, EventArgs e)        {        }

form to add controls to the form to show and hide

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.