Window operating system, everywhere is the form
Simple, powerful, convenient and flexible
Steps to create a new project project type Visual C # project Template window application
Separate the code for the same form into two files with partial:
One stored in VS auto-generated code
Colon denotes inheritance
Like a child inherits the characteristics of a parent all forms inherit form
Form title: Name
Form icons: Icon
Picture Background backgroundimage
Background color BackColor
Maximize button: Maximinbox
Minimize button: Minimun
form border Style: Fromborderstyle
Form initial Position: StartPosition
Form Status: Windowsstate
Help button: HelpButton
Naming conventions-prefixes
Control Name control class name naming prefix
Tag Label Lal
Text box textbox txt
Combo box ComboBox Cbo
Pushbutton button BTN
Normalization of naming improves program readability and maintainability
Tag label
Image: Images on a label
Text: Display of texts
Text box textbox:
MaxLength: Maximum number of characters
MultiLine: Whether multiple lines of text can be entered
PasswordChar: The password character that is displayed as a password box
ReadOnly: whether to allow editing
Text: Associated Literals
Combo Box combobox
Items: item in a combo box
DropDownStyle: Style of combo box
Text: Combo box associated
SelectedIndex: Index of the currently selected item, starting at 0
SelectedItem: Gets the currently selected item
Buttons button
Enable: Whether the control is available
Text: Display file
TextAlign: How text is aligned
Windows applications are event-driven
Event-driven: respond to user-triggered events at any time, making appropriate processing
What we need to do.
Write the appropriate event handlers for related events
Steps for writing event handlers
Select the control in the Properties window click Find Event double click Generate event handling method to write processing code
If the event event handling method is not triggered, check that the event handler is set correctly in the Properties window
form from
Load event: triggered when form loads
Text box textbox:
TextChanged event: triggered when text changes
Buttons button
Click event: Clicked Trigger Touch
There are so many events for each control that we only need to focus on common events
MessageBox message Box
Why use a message box?
displaying messages
Request a message to a user
Implementation steps
1 Defining Form Objects
2 Display Form
Grammar
The called Form class name Form object =new the Called Form class name ();
The Form object. Show ();
Initial Windows programs