WinForm Developing control Collections

Source: Internet
Author: User


One, form:
Text,icon,maximizebox,minimizebox
FormBorderStyle
Backcolor,backgroundimage,backgroundimagelayout
Showintaskbar,opacity,topmost,startposition,windowstate
Acceptbutton,cancelbutton
Second, the control:
(a) Common controls: Tag
Label:
Text,image,forecolor,backcolor,font,autosize
Textalign,imagealign

Textbox:
Text,forecolor,backcolor,font,borderstyle
Readonly,multiline,password,maxlength

Click,doubleclick,change,......

Button
Text,image,forecolor,backcolor,font
Textalign,imagealign
Flat,flatappearence

Need to make 360 or QQ on the close, Maximize, minimize button.

Radiobutton,checkbox
Text,image,checked,forecolor,backcolor,font,autosize
Textalign,imagealign
Float,flatappreaence
Appearence

Datetimepicker:value

Case: Login, sign up, add a person


(b), composite control:
1.combobox,listbox
Property:
items--Items
Datasource,displaymember,valuemember
Selecteditem,selctedindex

Function:
A. Fill in the data
Add by using for or foreach: Overriding the ToString () of the Entity object
Use DataSource binding set full.

B. Take the selected content out.
Selecteditem-object, you need to cast to the type that should belong.
Selectedindex-int the selected index number

C. Set an item as selected
Assigns a value to SelectedIndex or SelectedItem.
Each item in the for or foreach traversal list determines whether it is to be set to the selected item, and then assigns a value to SelectedIndex or SelectedItem.

Case: National drop-down list, list box linkage

2.ListView
Property:
View
Items
Selectionmode-fullrow
Selecteditem-object
Headers:
A. Four views: view-largeicon,smallicon,list,tile,details
B. Composition: Composed of ListViewItem. And each ListViewItem contains ListViewSubItem
Properties of the ListViewItem: Text,image,tag,subitems.
C. Fill in the contents:
Fetch the data, send it in (foreach iterates through the extracted data, creating a ListViewItem object for each data, adding to the ListView)
D. Get the selected item. SelectedItem

3.DatagridView
Property:
datasource-Binding Data sources
Columns-Management of columns
Rows-a collection of rows
Whether to allow additions, modifications, deletions
Selectionmode-fullrow

Function:
A. Display the data bindings. (gender, ethnicity, extension)
B. Take the selected item out. datagridview.rows[index number]. Databounditem as Entity object

Case: additions and deletions, the expansion of the personnel table, the purchase of fruit table.

Third, the layout
Empty layout: Location and anchor of the control itself
Boundary layout: The Dock property of the control itself
Grid layout: TableLayoutPanel controls
Streaming Layouts: FlowLayoutPanel controls
Card layout: TabControl controls
Split layout: SplitContainer controls

Iv. communication before the form:
Use the constructor function.
Public property or method

Five, dialog box
(a) System dialog box
Colordialog,fontdialog,opendialog,savedialog,folderdialog
(ii) Custom dialog box
1. Build the form
2. Instantiate the form and display it using ShowDialog
3. Receive with DialogResult
In the Customize dialog box, you need to return to DialogResult and do not need to invoke features such as closing or opening the form.

Vi. Menus and tool strips
MenuStrip
ContextMenuStrip
Toolbarstrip
notifyicon--tray icon

Vii. SDI and MDI
sdi--A main form, multiple dialog boxes
Application: Login.
mdi--A parent form, multiple child forms.
1. Parent form to set ismdiparent
2. For each subform it generates, set mdiparent--to specify this.
Apply: Create a new multi-subform, create a new subform (which does not recur), close the specified subform, and close all subforms.

Eight, the flow
FileStream
1. Build:
2. READ:
3. Write:
StreamWriter
StreamReader

WinForm Developing control Collections

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.