Winfroms --- check the guest service ~, Winfroms --- guest
If you have a rational mind, you have to catch up with it. You don't have to worry about what you are doing. Do you want to laugh when others are watching it, you don't need to use it either. People have been born for dozens of years. For example, if the year is light, they are afraid that the wolf will be afraid of tigers and will not be able to catch up with each other, when you reach the age of 40 and 50, the only thing you can do is to feel the loss of the age of the month...
It is safe to dock a ship in a harbor, but this is not the purpose of shipbuilding.
If you want to have stronger self-control, you must have more self-consciousness.
By: Wu AO, Beida qingniao wudaokou
Chapter 1 first knowledge of Windows program 01. Introduction to console applications
Resolution: console application: displayed in dos window
Windows Forms applications: a program that involves controls and supports events.
02. Know Windows programs
1. Form1.cs: A Form file. The Code Compiled by the programmer for the form is generally stored in this file.
2. From1.Designer. cs: Form Design file. The code is automatically generated by Visual Studio and does not need to be modified.
3. From1.resx: resource file used to configure the strings, images, and other resources used by the current form.
4. Program. cs: Main Program file, which contains the Main () method of the Program entry.
03. Main methods and attributes of Winfroms forms
* 01. A solution can contain multiple projects,
* A project can contain multiple forms.
* 02. How do I set a form under a project as a startup form ???
* Resolution: Change the setting of the last line of code in the Program. csMain method.
* 03. The Name attribute of the control is equivalent to a hidden value and must be changed.
* The Text attribute is actually displayed in the form.
* 04. If a solution has multiple projects, how do I set a project as a startup item ??
* Resolution: you can right-click a project and set it as a startup Item.
* 05. How do I save the IDC project or open it after saving it ???
* Resolution: You can save the solution to a specified project. next time
* You can directly open the sln file.
* 06. An error occurs when an event is triggered ???
* Resolution: pay attention to when events will be triggered
* 07. How can I make the form unable to change the size after running?
* Resolution: Use the following settings:
* 01. Disable the maximize button
* 02. Set the FormBorderStyle attribute to any attribute starting with Fixed.
04. constructor:
Resolution: in a class, a method with the same method name and class name without the return value type is called a constructor.
Purpose: Perform initialization.
05. Event details
Analysis: The State of another thing (BIRD) is changed by external things (shotgun.
The event looks like a method with parameters and two parameters.
Sender: indicates the event Source: The Event initiator.
E: event parameters: Event-related information!
06. MessageBox
Parameter 1: prompt information
Parameter 2: Title text
Parameter 3: button settings
Parameter 4: icon settings
MessageBox. Show ("Congratulations, you have won 500. Can you have dinner? "," Tip ", MessageBoxButtons. YesNo, MessageBoxIcon. Warning );
07. Pass values in the form
Resolution: Pass the Login user name from the Login form to the Main form. You can define a public variable in the Main form, and then write the following code in the logon button event of the Login form:
Main frm = new Main ();
Frm. name = txtName. Text;
Frm. Show ();
Then assign values to the Label control in the load event of Main.
08. Exit the program
In the FormClosing event of the form, write Application. Exit ();
What are you waiting ??!!!
Fair (fair Fair • Fair ω fair • Fair fair Fair) Fair