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