C # Development WinForm (Common controls)

Source: Internet
Author: User
First, the client design ideas

1. Straighten out design ideas and framework

2. Design interface

3. Writing Background code

4. Database access

Second, public control

1. button (buttons):

⑴enabled: Determines whether the control is enabled

⑵visible: Determines whether the control is courseware;

2. CheckBox (multi-option), Checklistbox-(Multi-option list)

3. ComboBox (Displays an editable text box that can be pulled down to select a value):

①, Data fill in

You can put in the items collection in the background to fill in the content

private void Button1_Click (object sender, EventArgs e)        {for            (int i = 0; i < 8; i++)            {                combobox1.items. ADD (i);            }        }

②, how to fetch the selected data (SelectedItem)

MessageBox.Show (ComboBox1.SelectedItem.ToString ());

⑴dropdownstyle: only allow selection;

⑵selectedindex: Default Check

Added in the constructor: Combobox1.selectedindex = 0;

4, DateTimePicker (allows the user to select a date and time, and displays the date and time in the specified format):

Value:

MessageBox.Show (Datetimepicker1.text); Chinese Date MessageBox.Show (dateTimePicker1.Value.ToString ());//datetime type

Assignment value:

DateTime dt=converttodatetime ("2000-1-1");d Atetimepicker1.value=dt;

5. Label (provides run-time information and descriptive text for the control)

LinkLabel (displays label controls that support hyperlink functionality)

private void Linklabel1_click (object sender, EventArgs e)        {            Process.Start ("Chrome", "http://www.sina.com.cn" );}

6. ListBox (displays a list from which the user can select items)

Selectionmode:none not let select one can only choose a multiextended multisimple multi-election, and do not have to be re-hunting;

How to get the full contents of multiple selections in the background:

Use the SelectedItems collection 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 collection of display items in five different views)

8. MaskedTextBox (use mask to differentiate between correct and incorrect user input):

Mask: Sets the string that controls the input allowed by this control

9, MonthCalendar (Calendar):

Maxselectioncount Select the date, you can select the maximum number of days

Backstage Code: SelectionStart selectionend

MessageBox.Show (monthCalendar1.SelectionStart.ToString () + "-" + monthCalendar1.SelectionEnd.ToString ());

10, NotifyIcon (Tray program):

⑴visible: Is it visible;

⑵icon: Small icon;

⑶text: Display name;

11, NumericUpDown (You can click the button on the control to increase or decrease a value of the marquee)

⑴increment: Click the button to increase or decrease the value of each;

⑵maximum: Maximum value;

⑶minimum: Minimum value;

12, PictureBox (Put pictures):

⑴image-Bad use;

⑵backgroundimage: Usually put here, with BackgroundImageLayout layout use

13. ProgressBar (progress bar):

⑴value: the initial value;

⑵maximum: Maximum value;

⑶minimum: Minimum value;

⑷style–marquee: Do not show progress, only show in work

⑸marquee...speed: The speed at which the progress bar does not show progress

14, RichTextBox (large text box):

can use escape character text-\r\n in background

15. TextBox (text box):

⑴multiline: Multi-line editing

⑵scrollbars: Scroll bar display

⑶tabindex:tab key sequential index, starting from zero;

⑷tabstop:fasle tab Focus does not move in

16. TOOLTIP (note):

⑴tooltiptitle: Comment Content

As soon as you drag it in, the Miscellaneous property of all the controls is the one that sets the description for this control.

⑵initialdelay: How many seconds to hover to display annotations;

⑶reshowdelay: How long changes the control can convert comments

17. TreeView (Tree-mounted list)

18. WebBrowser (Browser creation)

Url (property)-Uri (object

Uri u = new uri (TextBox1.Text);
Webbrowser1.url = u;

The above is the content of C # development WinForm (common control), more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!




  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.