Winform (public control) and winform Control
I. Client design ideas
1. Straighten out the design ideas and architecture framework
2. Design Interface
3. Write background code
4. Database Access
Ii. Public controls
1. Button ):
(1) Enabled: Determine whether to enable the control.
(2) Visible: determines whether the control is a courseware;
2. CheckBox (Multi-option) and CheckListBox-(Multi-Option List)
3. ComboBox (an editable text box is displayed. You can select a value from the drop-down list ):
① Fill in the data
You can put the content to be entered in the background in the Items collection.
private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < 8; i++) { comboBox1.Items.Add(i); } }
②. How to obtain the selected data (SelectedItem)
MessageBox.Show(comboBox1.SelectedItem.ToString());
(1) DropDownStyle: select only;
(2) SelectedIndex: selected by default.
Add comboBox1.SelectedIndex = 0 to the constructor;
4. dateTimePicker (allows users to select a date and time and display the date and time in the specified format ):
Valid value:
MessageBox. Show (dateTimePicker1.Text); // Chinese Date MessageBox. Show (dateTimePicker1.Value. ToString (); // DateTime type
Assignment:
DateTime dt=ConvertToDateTime(“2000-1-1”);dateTimePicker1.Value=dt;
5. Label (provide runtime information and descriptive text for the Control)
LinkLabel)
private void linkLabel1_Click(object sender, EventArgs e) { Process.Start("Chrome", "http://www.sina.com.cn");}
6. ListBox (display the list of items that can be selected by the user)
SelectionMode: None do not allow you to select only One MultiExtended connection or multiple multiimple connections;
In the background, how do I obtain all the multiple options:
Use the SelectedItems set to traverse them
private void button3_Click(object sender, EventArgs e) { string a = ""; foreach(object o in listBox1.SelectedItems) { a += o.ToString(); }
7. ListView (a set of display items in five different views)
8. MaskedTextBox (use a mask to distinguish between correct and incorrect user input ):
Mask: Set to control the input strings allowed by this control
9. MonthCalendar (calendar ):
MaxSelectionCount
Background code: SelectionStart SelectionEnd
MessageBox.Show(monthCalendar1.SelectionStart.ToString() + "-" + monthCalendar1.SelectionEnd.ToString());
10. yyicon (pallet program ):
(1) Visible: Visible or not;
(2) Icon: small Icon;
(3) Text: Display name;
11. NumericUpDown (you can click the button on the control to add or remove a selected value)
(1) increment: click the button to increase or decrease the value each time;
(2) Maximum: the Maximum value;
(3) Minimum: Minimum value;
12. pictureBox (picture placement ):
(1) Image-unavailable;
(2) BackgroundImage: This is generally used in combination with the BackgroundImageLayout layout.
13. ProgressBar (progress bar ):
(1) Value: the initial Value;
(2) Maximum: Maximum value;
(3) Minimum: Minimum value;
(4) style-marquee: Progress is not displayed, but only displayed at work.
⑸ Marquee... speed: the speed of calculation when the progress bar is not displayed.
14. RichTextBox (large text box ):
Escape characters text-\ r \ n can be used in the background
15. TextBox ):
(1) Multiline: Multiline editing
(2) ScrollBars: scroll bar display
(3) TabIndex: ordered index of the Tab key, starting from scratch;
(4) TabStop: When fasle is used, the tab focus cannot be moved in.
16. ToolTip (Note ):
(1) ToolTipTitle: Comment content
As long as the control is dragged in, there will be one more attribute in all the miscellaneous controls, which is used to set the introduction of this control.
(2) InitialDelay: How many seconds can the comments be displayed when hovering;
(3) ReshowDelay: Change the time for the control to convert comments.
17. TreeView (tree Assembly List)
18. WebBrowser (Browser creation)
Url (attribute)-Uri (Object
Uri u = new Uri(textBox1.Text); webBrowser1.Url = u;