WinForm ListView Control, container control

Source: Internet
Author: User

First, the ListView Class 1, the basic properties commonly used:

(1) Fullrowselect: Sets whether row selection mode. (False by default) Tip: This property is meaningful only in the details view.
(2) GridLines: Sets whether grid lines are displayed between rows and columns. (False by default) Tip: This property is meaningful only in the details view.
(3) Allowcolumnreorder: Sets whether the column headers can be dragged to change the order of the columns. (False by default) Tip: This property is meaningful only in the details view.
(4) View: Gets or sets how items are displayed in the control, including details, LargeIcon, List, SmallIcon, Tile (default = LargeIcon)
(5) MultiSelect: Sets whether multiple items can be selected. (default = False)
(6) HeaderStyle: Gets or sets the column header style.
Clickable: The column header acts like a button, and you can perform actions (such as sorting) when clicked.
Nonclickable: Column headers do not respond to mouse clicks.
None: Column headers are not displayed.
(7) LabelEdit: Sets whether the user can edit the label of items in the control, and for the detail view, only the contents of the first column of the row are edited. (default = False)
(8) Checkboxes: Sets whether the check box is displayed next to items in the control. (default = False)
(9) LargeImageList: Large icon set. Tip: Use only in the LargeIcon view.
(Ten) SmallImageList: Small icon set. Tip: Use only in the SmallIcon view.

(one) StateImageList: Image mask. These image masks can be used as overlays for largeimagelist and smallimagelist images that indicate the application-defined state of an item. (Not quite understand)

SelectedItems: Gets the item selected in the control.
CheckedItems: Gets the item selected by the current check box in the control.
Soritng: Sorts items in a list view. (Default to None)
Ascending: Items are sorted in ascending order.
Descending: Items are sorted in descending order.
None: The item is not sorted.
(scrollable): Sets whether scroll bars are displayed when there is not enough space to display all items. (Default is True)
() Hoverselection: Sets whether items are automatically selected when the mouse pointer hovers over the item. (default = False)

HotTracking: Sets whether its appearance becomes a hyperlink when the mouse pointer passes through the item text. (default = False)
HideSelection: Sets whether the selected item is still highlighted when the control has no focus. (default = False)
Showgroups: Sets whether items are displayed in groups. (the default is false);
Groups: Sets the grouped object collection.
TopItem: Gets or sets the first visible item in a control that can be used for positioning. (Effect similar to EnsureVisible method)

2. Common methods:

(1) BeginUpdate: Avoid describing the control before calling the EndUpdate method. When you insert large amounts of data, you can effectively avoid flicker in the control and can greatly increase the speed.
(2) EndUpdate: After the BeginUpdate method hangs the description, continue to describe the list view control. (End update)
(3) EnsureVisible: The list view scrolls to the option line of the specified index entry. (Effect similar to Topitem property)
(4) FindItemWithText: Finds the first ListViewItem that begins with a given text value.
(5) FindNearestItem: Finds the next item from a given point, according to the specified search direction. Tip: You can use this method only in the LargeIcon or SmallIcon view.

3. Common events:

(1) AfterLabelEdit: Occurs when the user finishes editing the label of an item, the LabelEdit property is required to be true.
(2) BeforeLabelEdit: Occurs when the user starts editing the item's label.
(3) ColumnClick: Occurs when a user clicks on a column header in a list view control.

Two, five views of the ListView:

1. LargeIcon: Each item is displayed as a maximized icon with a label underneath it. (See results)

2, SmallIcon: Each item is shown as a small icon, on its right with a label. (See results)

3, List: Each item is displayed as a small icon, on its right with a label. The items are arranged in a column with no column headers. (See results)

4, Details: can display any column, but only the first column can contain a small icon and label, the other column items can only display text information, there is a list header. (See results)

This.listView1.SmallImageList = This.imagelist1; Binds the icon set of a ListView to ImageList1


5. Tile: Each item is displayed as a full-sized icon with item labels and subkey information on its right. (Only Windows XP and Windows Server 2003 series support)

2. Find text (only the text that matches the prefix can be found and only the first one is found):
this. Listview1.finditemwithtext (this. TextBox1.Text,true,0);   
// parameter 1: the text to find; parameter 2: Whether the child is also to be found; Parameter 3: Start Find location if NULL ) { this. Listview1.topitem = Founditem; // navigate to the item = color.red; }

WinForm ListView Control, container control

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.