The first thing we will be unfamiliar, we slowly to understand it will understand, let me take you together to understand it.
A form is one of the most basic form classes defined by the. Net Framework, with form basic properties and methods
| Property |
Description |
| MaximizeBox |
Determines whether the upper-right corner of the form's title bar------ has a maximized box -----------default to True |
| ShowInTaskbar |
Determines whether the form appears in the----------taskbar ------Default to True |
| StartPosition |
Determine where the form first appears---------- |
| WindowState |
Determine the status of the form's start |
| FormBorderStyle |
After startup, the user can drag the form size with the mouse---------------set the value to FixedSingle |
| Method |
Description |
| Close () |
Close the form |
| Show () |
Show form |
| Showdialong () |
Modal Display Form |
| Hide () |
Hide Form |
Two. Basic controls
Label----------------------------------eg. user name
A text box (textbox)------A blank box-------------------
| Property |
Description |
| MaxLength |
Specifies the maximum number of characters entered in the text box |
| Multiline |
whether multiple lines of text can be entered in the text |
| PasswordChar |
Password box |
| ReadOnly |
Read-only cannot be changed |
Combo Box (ComboBox)----------------eg. Login type, admin and user
| Properties |
Description |
| items |
combo box Items |
| dropdownstyle |
allow user to edit text box |
| selectedindex |
Current selection The index number of the fixed item, starting with 0 |
| selecteditem |
get currently selected items |
| events &NBS p; |
description |
| click |
When you click the control Occurs |
| selectedindexchanged |
occurs after the SelectedIndex property is modified |
| method |
Description |
| Add () |
Add Item |
| Clear () & nbsp &NBSP |
Remove all items |
| Remove () |
Remove the specified item |
Button--------------
| Property |
Description |
| Enable |
Boolean value that indicates whether the control can be used |
message box (MESSAGEBOX)
In Windows , a message box is a MessageBox object , and if you want to create a message box, you need to use the MessageBox.Show () method .
There are four types of commonly used message boxes .
01.messagebox.show (The string to display );
02.messagebox.show (The string to display , the caption of the message box );
03.messagebox.show (The string to display , the message box caption , the message box button );
04.messagebox.show (The string to display , the message box caption , the message box button , the message box icon );
Eg:MessageBoxButton.AbortRetryIgnore
Messageboxbutton.ok
Messageboxbutton.okcancel
Messageboxbutton.retrycancel
Messageboxbutton.yesno
Messageboxbuttons.yesnocancel
The third parameter , Messagboxbutton, sets the button that the message box displays . You can pass the "." To select the type of button you want .
MessageBoxIcon.Information
Messageboxicon.error
Messageboxicon.exclamation
Messageboxicon.question
Menu bar control (MenuStrip)------------
Toolbar control (ToolStrip)----------------------
| Property |
Description |
| Imagescalingsize |
The items in the toolbar show the size of the picture |
| Displaystyle |
Set Display picture or text |
| Imagescaling |
Whether to adjust the button or label to show the size of the picture |
radio button (RadioButton)--------------
Group Box (GROUPBOX)-------------
Panel--------------------Add student users
Date control (DateTimePicker)-------------------
| Property |
Description |
| Value |
The date and control values selected by the control |
Image List Control (ImageList)----------colordepth (Gets the color depth of the image list)
shortcut menu (ContextMenuStrip)------
| Property |
Description |
| Displaystyle |
Whether to display text and images |
| GridLines |
Show Gridlines---default value true |
| MultiSelect |
Do not allow multiple selection-----default value False |
Picture box control (PictureBox)
A Timer control (timer) in the toolbox-----
| Property |
Description |
| Interval |
The frequency, in milliseconds, at which the event occurred |
| Enabled |
Whether to raise the event regularly (on or off) |
| Event |
Description |
| Tick |
Events that occur whenever an interval is specified |
| Method |
Description |
| Start () |
Start timer |
| Stop () |
Stop Timer |
Four. Code parsing
Event: When the user is triggered by a mouse or keyboard to "some specific behavior of the button"
Private void button1_click (object sender, EventArgs e) { this. Close (); }
Sender--------------is the source of the event
E------------is the event argument (EventArgs) object
A code implementation form in the form closes----------------this. Close ();
This---------is a keyword that represents the current form object
The close ()----------method is a method of form class forms that is used to close the form
Five. The jump of the form
Private void Bulogin_click (object sender, EventArgs e) {// method call From a=new from (); Show (); // Hide Method this.hide ();
Knowledge points to learn about Windows programs