ListViewItem ListViewItem ListViewItem ListViewItem Class

定义

表示 ListView 控件中的一个项。Represents an item in a ListView control.

public ref class ListViewItem : ICloneable, System::Runtime::Serialization::ISerializable
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ListViewItemConverter))]
[System.Serializable]
public class ListViewItem : ICloneable, System.Runtime.Serialization.ISerializable
type ListViewItem = class
    interface ICloneable
    interface ISerializable
Public Class ListViewItem
Implements ICloneable, ISerializable
继承
ListViewItemListViewItemListViewItemListViewItem
属性
实现

示例

下面的代码示例将创建ListView有三个控件ListViewItem指定的对象和三个ListViewItem.ListViewSubItem为每个项指定的对象。The following code example creates a ListView control with three ListViewItem objects specified and three ListViewItem.ListViewSubItem objects specified for each item. 此示例还创建ColumnHeader对象详细信息视图中显示子项。The example also creates ColumnHeader objects to display the subitems in details view. 两个ImageList对象也会在代码示例中提供的映像ListViewItem对象。Two ImageList objects are also created in the code example to provide images for the ListViewItem objects. 这些ImageList对象添加到LargeImageListSmallImageList属性。These ImageList objects are added to the LargeImageList and SmallImageList properties. 该示例使用以下属性在创建ListView控件:The example uses the following properties in creating the ListView control:

您需要将代码添加到Form和调用构造函数或在窗体上的另一种方法中的示例中创建的方法。You need to add the code to a Form and call the method created in the example from the constructor or another method on the form. 该示例需要映像名为MySmallImage1MySmallImage2MyLargeImage1,和MyLargeImage2位于根目录下的驱动器 c。The example requires that images named MySmallImage1, MySmallImage2, MyLargeImage1, and MyLargeImage2 are located in the root directory of drive C.

private:
   void CreateMyListView()
   {
      // Create a new ListView control.
      ListView^ listView1 = gcnew ListView;
      listView1->Bounds = Rectangle(Point(10,10),System::Drawing::Size( 300, 200 ));

      // Set the view to show details.
      listView1->View = View::Details;

      // Allow the user to edit item text.
      listView1->LabelEdit = true;

      // Allow the user to rearrange columns.
      listView1->AllowColumnReorder = true;

      // Display check boxes.
      listView1->CheckBoxes = true;

      // Select the item and subitems when selection is made.
      listView1->FullRowSelect = true;

      // Display grid lines.
      listView1->GridLines = true;

      // Sort the items in the list in ascending order.
      listView1->Sorting = SortOrder::Ascending;

      // Create three items and three sets of subitems for each item.
      ListViewItem^ item1 = gcnew ListViewItem( "item1",0 );

      // Place a check mark next to the item.
      item1->Checked = true;
      item1->SubItems->Add( "1" );
      item1->SubItems->Add( "2" );
      item1->SubItems->Add( "3" );
      ListViewItem^ item2 = gcnew ListViewItem( "item2",1 );
      item2->SubItems->Add( "4" );
      item2->SubItems->Add( "5" );
      item2->SubItems->Add( "6" );
      ListViewItem^ item3 = gcnew ListViewItem( "item3",0 );

      // Place a check mark next to the item.
      item3->Checked = true;
      item3->SubItems->Add( "7" );
      item3->SubItems->Add( "8" );
      item3->SubItems->Add( "9" );

      // Create columns for the items and subitems.
      // Width of -2 indicates auto-size.
      listView1->Columns->Add( "Item Column", -2, HorizontalAlignment::Left );
      listView1->Columns->Add( "Column 2", -2, HorizontalAlignment::Left );
      listView1->Columns->Add( "Column 3", -2, HorizontalAlignment::Left );
      listView1->Columns->Add( "Column 4", -2, HorizontalAlignment::Center );

      //Add the items to the ListView.
      array<ListViewItem^>^temp1 = {item1,item2,item3};
      listView1->Items->AddRange( temp1 );

      // Create two ImageList objects.
      ImageList^ imageListSmall = gcnew ImageList;
      ImageList^ imageListLarge = gcnew ImageList;

      // Initialize the ImageList objects with bitmaps.
      imageListSmall->Images->Add( Bitmap::FromFile( "C:\\MySmallImage1.bmp" ) );
      imageListSmall->Images->Add( Bitmap::FromFile( "C:\\MySmallImage2.bmp" ) );
      imageListLarge->Images->Add( Bitmap::FromFile( "C:\\MyLargeImage1.bmp" ) );
      imageListLarge->Images->Add( Bitmap::FromFile( "C:\\MyLargeImage2.bmp" ) );

      //Assign the ImageList objects to the ListView.
      listView1->LargeImageList = imageListLarge;
      listView1->SmallImageList = imageListSmall;
      
      // Add the ListView to the control collection.
      this->Controls->Add( listView1 );
   }
private void CreateMyListView()
{
	// Create a new ListView control.
	ListView listView1 = new ListView();
	listView1.Bounds = new Rectangle(new Point(10,10), new Size(300,200));

	// Set the view to show details.
	listView1.View = View.Details;
	// Allow the user to edit item text.
	listView1.LabelEdit = true;
	// Allow the user to rearrange columns.
	listView1.AllowColumnReorder = true;
	// Display check boxes.
	listView1.CheckBoxes = true;
	// Select the item and subitems when selection is made.
	listView1.FullRowSelect = true;
	// Display grid lines.
	listView1.GridLines = true;
	// Sort the items in the list in ascending order.
	listView1.Sorting = SortOrder.Ascending;
          			
	// Create three items and three sets of subitems for each item.
	ListViewItem item1 = new ListViewItem("item1",0);
	// Place a check mark next to the item.
	item1.Checked = true;
	item1.SubItems.Add("1");
	item1.SubItems.Add("2");
	item1.SubItems.Add("3");
	ListViewItem item2 = new ListViewItem("item2",1);
	item2.SubItems.Add("4");
	item2.SubItems.Add("5");
	item2.SubItems.Add("6");
	ListViewItem item3 = new ListViewItem("item3",0);
	// Place a check mark next to the item.
	item3.Checked = true;
	item3.SubItems.Add("7");
	item3.SubItems.Add("8");
	item3.SubItems.Add("9");

	// Create columns for the items and subitems.
	// Width of -2 indicates auto-size.
	listView1.Columns.Add("Item Column", -2, HorizontalAlignment.Left);
	listView1.Columns.Add("Column 2", -2, HorizontalAlignment.Left);
	listView1.Columns.Add("Column 3", -2, HorizontalAlignment.Left);
	listView1.Columns.Add("Column 4", -2, HorizontalAlignment.Center);

	//Add the items to the ListView.
          listView1.Items.AddRange(new ListViewItem[]{item1,item2,item3});

	// Create two ImageList objects.
	ImageList imageListSmall = new ImageList();
	ImageList imageListLarge = new ImageList();

	// Initialize the ImageList objects with bitmaps.
	imageListSmall.Images.Add(Bitmap.FromFile("C:\\MySmallImage1.bmp"));
	imageListSmall.Images.Add(Bitmap.FromFile("C:\\MySmallImage2.bmp"));
	imageListLarge.Images.Add(Bitmap.FromFile("C:\\MyLargeImage1.bmp"));
	imageListLarge.Images.Add(Bitmap.FromFile("C:\\MyLargeImage2.bmp"));

	//Assign the ImageList objects to the ListView.
	listView1.LargeImageList = imageListLarge;
	listView1.SmallImageList = imageListSmall;

	// Add the ListView to the control collection.
	this.Controls.Add(listView1);
}
Private Sub CreateMyListView()
    ' Create a new ListView control.
    Dim listView1 As New ListView()
    listView1.Bounds = New Rectangle(New Point(10, 10), New Size(300, 200))

    ' Set the view to show details.
    listView1.View = View.Details
    ' Allow the user to edit item text.
    listView1.LabelEdit = True
    ' Allow the user to rearrange columns.
    listView1.AllowColumnReorder = True
    ' Display check boxes.
    listView1.CheckBoxes = True
    ' Select the item and subitems when selection is made.
    listView1.FullRowSelect = True
    ' Display grid lines.
    listView1.GridLines = True
    ' Sort the items in the list in ascending order.
    listView1.Sorting = SortOrder.Ascending

    ' Create three items and three sets of subitems for each item.
    Dim item1 As New ListViewItem("item1", 0)
    ' Place a check mark next to the item.
    item1.Checked = True
    item1.SubItems.Add("1")
    item1.SubItems.Add("2")
    item1.SubItems.Add("3")
    Dim item2 As New ListViewItem("item2", 1)
    item2.SubItems.Add("4")
    item2.SubItems.Add("5")
    item2.SubItems.Add("6")
    Dim item3 As New ListViewItem("item3", 0)
    ' Place a check mark next to the item.
    item3.Checked = True
    item3.SubItems.Add("7")
    item3.SubItems.Add("8")
    item3.SubItems.Add("9")

    ' Create columns for the items and subitems.
    ' Width of -2 indicates auto-size.
    listView1.Columns.Add("Item Column", -2, HorizontalAlignment.Left)
    listView1.Columns.Add("Column 2", -2, HorizontalAlignment.Left)
    listView1.Columns.Add("Column 3", -2, HorizontalAlignment.Left)
    listView1.Columns.Add("Column 4", -2, HorizontalAlignment.Center)

    'Add the items to the ListView.
    listView1.Items.AddRange(New ListViewItem() {item1, item2, item3})

    ' Create two ImageList objects.
    Dim imageListSmall As New ImageList()
    Dim imageListLarge As New ImageList()

    ' Initialize the ImageList objects with bitmaps.
    imageListSmall.Images.Add(Bitmap.FromFile("C:\MySmallImage1.bmp"))
    imageListSmall.Images.Add(Bitmap.FromFile("C:\MySmallImage2.bmp"))
    imageListLarge.Images.Add(Bitmap.FromFile("C:\MyLargeImage1.bmp"))
    imageListLarge.Images.Add(Bitmap.FromFile("C:\MyLargeImage2.bmp"))

    'Assign the ImageList objects to the ListView.
    listView1.LargeImageList = imageListLarge
    listView1.SmallImageList = imageListSmall

    ' Add the ListView to the control collection.
    Me.Controls.Add(listView1)
End Sub 'CreateMyListView

注解

ListView控件是类似于ListBox,因为它显示的项的列表。The ListView control is similar to a ListBox in that it displays a list of items. 主要区别在于ListView控件提供了可以由用户查看不同的方式项数。The main difference is that the ListView control provides a number of different ways items can be viewed by the user. ListViewItem类定义外观、 行为和数据中显示的项与相关联ListView控件。The ListViewItem class defines the appearance, behavior, and data associated with an item that is displayed in the ListView control. ListViewItem 对象可以显示在ListView一个四个不同的视图中的控件。ListViewItem objects can be displayed in the ListView control in one of four different views. 项可以显示为大或小图标或垂直列表中的小图标。Items can be displayed as large or small icons or as small icons in a vertical list. 项还可以包含与父项相关的信息的子项。Items can also have subitems that contain information that is related to the parent item. 第四个视图样式,详细信息视图,使您可以用于标识要显示在子项中的信息的列标题以网格显示该项及其子项。The fourth view style, details view, allows you to display the item and its subitems in a grid with column headers that can be used to identify the information being displayed in a subitem.

属性的大多数ListViewItem类提供了方法中的项的显示更改ListView与之关联的控件。Most of the properties of the ListViewItem class provide ways to change the display of the item in the ListView control it is associated with. BackColorForeColor,并Font属性,您可以更改项的文本中的显示方式ListView控件。The BackColor, ForeColor, and Font properties allow you to change how the text of the item is displayed in the ListView control. ImageIndex属性可以指定要从加载的映像ImageList分配给ListView控件 (通过设置LargeImageListSmallImageList属性的ListView)。The ImageIndex property allows you to specify the image to load from the ImageList that is assigned to the ListView control (by setting the LargeImageList or SmallImageList properties of the ListView). 项可以显示复选框,以便从一种类似于中的用户获取项选择CheckedListBox控件。Items can display check boxes in order to obtain item choices from the user in a way similar to a CheckedListBox control. 可以使用Checked属性以确定是否项被选中,或者,选中或清除该复选框,在运行时。You can use the Checked property to determine if an item is checked, or to select or clear the check box at run time. 项可以显示任意数量的子项时View关联的属性ListView控件设置为Details和列定义中ListView.ColumnHeaderCollectionListView控件。Items can display any number of subitems when the View property of the associated ListView control is set to Details and columns are defined in the ListView.ColumnHeaderCollection of the ListView control. 可以通过调用某个项添加子项Add方法的ListViewItem.ListViewSubItemCollection类。You can add subitems to an item by calling the Add method of the ListViewItem.ListViewSubItemCollection class. SubItems属性可用于访问ListViewItem.ListViewSubItemCollection类和其成员。The SubItems property allows you to gain access to the ListViewItem.ListViewSubItemCollection class and its members.

属性和方法的一些ListViewItem类是特定于项的版本中的属性和方法ListView控件。Some of the properties and methods of the ListViewItem class are item-specific versions of properties and methods in the ListView control. 例如,EnsureVisible方法是类似于ListView版本的方法,但ListViewItem版本会影响仅当前项。For example, the EnsureVisible method is similar to the ListView version of the method, but the ListViewItem version affects only the current item.

ListViewItem类还提供了方法不是版本的ListView方法。The ListViewItem class also provides methods that are not versions of ListView methods. BeginEdit方法将项的文本置于编辑模式以便用户可以更改项的文本 (时LabelEdit的属性ListView控件设置为true)。The BeginEdit method places the item's text into edit mode so the user can change the item's text (when the LabelEdit property of the ListView control is set to true). Clone方法,可创建的现有副本ListViewItem要重用在其他对象ListView控件。The Clone method allows you to create copies of existing ListViewItem objects to reuse in other ListView controls.

构造函数

ListViewItem() ListViewItem() ListViewItem() ListViewItem()

使用默认值初始化 ListViewItem 类的新实例。Initializes a new instance of the ListViewItem class with default values.

ListViewItem(ListViewGroup) ListViewItem(ListViewGroup) ListViewItem(ListViewGroup) ListViewItem(ListViewGroup)

初始化的新实例ListViewItem类,并将其分配给指定的组。Initializes a new instance of the ListViewItem class and assigns it to the specified group.

ListViewItem(ListViewItem+ListViewSubItem[], Int32) ListViewItem(ListViewItem+ListViewSubItem[], Int32) ListViewItem(ListViewItem+ListViewSubItem[], Int32) ListViewItem(ListViewItem+ListViewSubItem[], Int32)

初始化的新实例ListViewItem类使用的图像索引位置的项的图标和一个数组ListViewItem.ListViewSubItem对象。Initializes a new instance of the ListViewItem class with the image index position of the item's icon and an array of ListViewItem.ListViewSubItem objects.

ListViewItem(ListViewItem+ListViewSubItem[], Int32, ListViewGroup) ListViewItem(ListViewItem+ListViewSubItem[], Int32, ListViewGroup) ListViewItem(ListViewItem+ListViewSubItem[], Int32, ListViewGroup) ListViewItem(ListViewItem+ListViewSubItem[], Int32, ListViewGroup)

初始化的新实例ListViewItem类使用的图像索引位置的项的图标和一个数组ListViewItem.ListViewSubItem对象,并将该项分配到指定的组。Initializes a new instance of the ListViewItem class with the image index position of the item's icon and an array of ListViewItem.ListViewSubItem objects, and assigns the item to the specified group.

ListViewItem(ListViewItem+ListViewSubItem[], String) ListViewItem(ListViewItem+ListViewSubItem[], String) ListViewItem(ListViewItem+ListViewSubItem[], String) ListViewItem(ListViewItem+ListViewSubItem[], String)

初始化的新实例ListViewItem类具有指定的子项和图像。Initializes a new instance of the ListViewItem class with the specified subitems and image.

ListViewItem(ListViewItem+ListViewSubItem[], String, ListViewGroup) ListViewItem(ListViewItem+ListViewSubItem[], String, ListViewGroup) ListViewItem(ListViewItem+ListViewSubItem[], String, ListViewGroup) ListViewItem(ListViewItem+ListViewSubItem[], String, ListViewGroup)

初始化的新实例ListViewItem类与指定的子项、 图像和组。Initializes a new instance of the ListViewItem class with the specified subitems, image, and group.

ListViewItem(SerializationInfo, StreamingContext) ListViewItem(SerializationInfo, StreamingContext) ListViewItem(SerializationInfo, StreamingContext) ListViewItem(SerializationInfo, StreamingContext)

使用指定的序列化信息和流上下文初始化 ListViewItem 类的新实例。Initializes a new instance of the ListViewItem class with the specified serialization information and streaming context.

ListViewItem(String) ListViewItem(String) ListViewItem(String) ListViewItem(String)

初始化的新实例ListViewItem与指定的项文本的类。Initializes a new instance of the ListViewItem class with the specified item text.

ListViewItem(String, Int32) ListViewItem(String, Int32) ListViewItem(String, Int32) ListViewItem(String, Int32)

初始化的新实例ListViewItem类包含指定的项的文本和项图标的图像索引位置。Initializes a new instance of the ListViewItem class with the specified item text and the image index position of the item's icon.

ListViewItem(String, Int32, ListViewGroup) ListViewItem(String, Int32, ListViewGroup) ListViewItem(String, Int32, ListViewGroup) ListViewItem(String, Int32, ListViewGroup)

初始化的新实例ListViewItem类包含指定的项的文本和图像索引位置的项的图标,并将该项分配到指定的组。Initializes a new instance of the ListViewItem class with the specified item text and the image index position of the item's icon, and assigns the item to the specified group.

ListViewItem(String, ListViewGroup) ListViewItem(String, ListViewGroup) ListViewItem(String, ListViewGroup) ListViewItem(String, ListViewGroup)

初始化的新实例ListViewItem与指定的项文本的类并将其分配到指定的组。Initializes a new instance of the ListViewItem class with the specified item text and assigns it to the specified group.

ListViewItem(String, String) ListViewItem(String, String) ListViewItem(String, String) ListViewItem(String, String)

初始化的新实例ListViewItem类具有指定的文本和图像。Initializes a new instance of the ListViewItem class with the specified text and image.

ListViewItem(String, String, ListViewGroup) ListViewItem(String, String, ListViewGroup) ListViewItem(String, String, ListViewGroup) ListViewItem(String, String, ListViewGroup)

初始化的新实例ListViewItem类指定的文本、 图像和组。Initializes a new instance of the ListViewItem class with the specified text, image, and group.

ListViewItem(String[]) ListViewItem(String[]) ListViewItem(String[]) ListViewItem(String[])

初始化的新实例ListViewItem类使用数组表示子项的字符串。Initializes a new instance of the ListViewItem class with an array of strings representing subitems.

ListViewItem(String[], Int32) ListViewItem(String[], Int32) ListViewItem(String[], Int32) ListViewItem(String[], Int32)

初始化的新实例ListViewItem类使用的图像索引位置的项的图标和表示子项的字符串数组。Initializes a new instance of the ListViewItem class with the image index position of the item's icon and an array of strings representing subitems.

ListViewItem(String[], Int32, Color, Color, Font) ListViewItem(String[], Int32, Color, Color, Font) ListViewItem(String[], Int32, Color, Color, Font) ListViewItem(String[], Int32, Color, Color, Font)

初始化的新实例ListViewItem用项图标的图像索引位置; 前景色、 背景色和项的字体和表示子项的字符串数组。Initializes a new instance of the ListViewItem class with the image index position of the item's icon; the foreground color, background color, and font of the item; and an array of strings representing subitems.

ListViewItem(String[], Int32, Color, Color, Font, ListViewGroup) ListViewItem(String[], Int32, Color, Color, Font, ListViewGroup) ListViewItem(String[], Int32, Color, Color, Font, ListViewGroup) ListViewItem(String[], Int32, Color, Color, Font, ListViewGroup)

初始化的新实例ListViewItem用项图标的图像索引位置; 前景色、 背景色和项的字体和表示子项的字符串数组。Initializes a new instance of the ListViewItem class with the image index position of the item's icon; the foreground color, background color, and font of the item; and an array of strings representing subitems. 将该项分配到指定的组。Assigns the item to the specified group.

ListViewItem(String[], Int32, ListViewGroup) ListViewItem(String[], Int32, ListViewGroup) ListViewItem(String[], Int32, ListViewGroup) ListViewItem(String[], Int32, ListViewGroup)

初始化的新实例ListViewItem类使用的图像索引位置的项的图标和一个数组,这些字符串表示子项,并将该项分配到指定的组。Initializes a new instance of the ListViewItem class with the image index position of the item's icon and an array of strings representing subitems, and assigns the item to the specified group.

ListViewItem(String[], ListViewGroup) ListViewItem(String[], ListViewGroup) ListViewItem(String[], ListViewGroup) ListViewItem(String[], ListViewGroup)

初始化的新实例ListViewItem类使用数组表示的字符串的子项,并将该项分配到指定的组。Initializes a new instance of the ListViewItem class with an array of strings representing subitems, and assigns the item to the specified group.

ListViewItem(String[], String) ListViewItem(String[], String) ListViewItem(String[], String) ListViewItem(String[], String)

初始化的新实例ListViewItem类具有指定的项和子项文本和图像。Initializes a new instance of the ListViewItem class with the specified item and subitem text and image.

ListViewItem(String[], String, Color, Color, Font) ListViewItem(String[], String, Color, Color, Font) ListViewItem(String[], String, Color, Color, Font) ListViewItem(String[], String, Color, Color, Font)

初始化的新实例ListViewItem类包含指定的文本、 图像、 颜色和字体的子项。Initializes a new instance of the ListViewItem class with the subitems containing the specified text, image, colors, and font.

ListViewItem(String[], String, Color, Color, Font, ListViewGroup) ListViewItem(String[], String, Color, Color, Font, ListViewGroup) ListViewItem(String[], String, Color, Color, Font, ListViewGroup) ListViewItem(String[], String, Color, Color, Font, ListViewGroup)

初始化的新实例ListViewItem类包含指定的文本、 图像、 颜色、 字体和组的子项。Initializes a new instance of the ListViewItem class with the subitems containing the specified text, image, colors, font, and group.

ListViewItem(String[], String, ListViewGroup) ListViewItem(String[], String, ListViewGroup) ListViewItem(String[], String, ListViewGroup) ListViewItem(String[], String, ListViewGroup)

初始化的新实例ListViewItem类包含指定的文本、 图像和组子项。Initializes a new instance of the ListViewItem class with subitems containing the specified text, image, and group.

属性

BackColor BackColor BackColor BackColor

获取或设置项的文本的背景色。Gets or sets the background color of the item's text.

Bounds Bounds Bounds Bounds

获取包括子项的项的边框。Gets the bounding rectangle of the item, including subitems.

Checked Checked Checked Checked

获取或设置一个值,该值指示是否选中项。Gets or sets a value indicating whether the item is checked.

Focused Focused Focused Focused

获取或设置一个值,该值指示该项是否具有中的焦点ListView控件。Gets or sets a value indicating whether the item has focus within the ListView control.

Font Font Font Font

获取或设置由该项显示的文本的字体。Gets or sets the font of the text displayed by the item.

ForeColor ForeColor ForeColor ForeColor

获取或设置项的文本的前景色。Gets or sets the foreground color of the item's text.

Group Group Group Group

获取或设置该项所分配到的组。Gets or sets the group to which the item is assigned.

ImageIndex ImageIndex ImageIndex ImageIndex

获取或设置为该项显示的图像的索引。Gets or sets the index of the image that is displayed for the item.

ImageKey ImageKey ImageKey ImageKey

获取或设置为该项显示的图像键。Gets or sets the key for the image that is displayed for the item.

ImageList ImageList ImageList ImageList

获取ImageList,其中包含与项显示的图像。Gets the ImageList that contains the image displayed with the item.

IndentCount IndentCount IndentCount IndentCount

获取或设置要缩进的小图像宽度数量ListViewItemGets or sets the number of small image widths by which to indent the ListViewItem.

Index Index Index Index

获取内的项的从零开始索引ListView控件。Gets the zero-based index of the item within the ListView control.

ListView ListView ListView ListView

获取ListView包含项的控件。Gets the ListView control that contains the item.

Name Name Name Name

获取或设置与此相关联的名称ListViewItemGets or sets the name associated with this ListViewItem.

Position Position Position Position

获取或设置的左上角位置ListViewItemGets or sets the position of the upper-left corner of the ListViewItem.

Selected Selected Selected Selected

获取或设置指示是否选定了项的值。Gets or sets a value indicating whether the item is selected.

StateImageIndex StateImageIndex StateImageIndex StateImageIndex

获取或设置状态图像 (例如选中或清除复选框,指示项的状态图像) 的索引,将显示的项。Gets or sets the index of the state image (an image such as a selected or cleared check box that indicates the state of the item) that is displayed for the item.

SubItems SubItems SubItems SubItems

获取包含项的所有子项的集合。Gets a collection containing all subitems of the item.

Tag Tag Tag Tag

获取或设置一个对象,包含与项关联的数据。Gets or sets an object that contains data to associate with the item.

Text Text Text Text

获取或设置项的文本。Gets or sets the text of the item.

ToolTipText ToolTipText ToolTipText ToolTipText

获取或设置当鼠标指针停留在上时显示的文本ListViewItemGets or sets the text shown when the mouse pointer rests on the ListViewItem.

UseItemStyleForSubItems UseItemStyleForSubItems UseItemStyleForSubItems UseItemStyleForSubItems

获取或设置一个值,该值指示是否FontForeColor,和BackColor项的属性用于其所有子项。Gets or sets a value indicating whether the Font, ForeColor, and BackColor properties for the item are used for all its subitems.

方法

BeginEdit() BeginEdit() BeginEdit() BeginEdit()

将项文本置于编辑模式。Places the item text into edit mode.

Clone() Clone() Clone() Clone()

创建项的完全相同副本。Creates an identical copy of the item.

Deserialize(SerializationInfo, StreamingContext) Deserialize(SerializationInfo, StreamingContext) Deserialize(SerializationInfo, StreamingContext) Deserialize(SerializationInfo, StreamingContext)

反序列化该项。Deserializes the item.

EnsureVisible() EnsureVisible() EnsureVisible() EnsureVisible()

确保该项是可见控件,如有必要时滚动控件的内容中。Ensures that the item is visible within the control, scrolling the contents of the control, if necessary.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
FindNearestItem(SearchDirectionHint) FindNearestItem(SearchDirectionHint) FindNearestItem(SearchDirectionHint) FindNearestItem(SearchDirectionHint)

查找下一项从ListViewItem,搜索指定的方向。Finds the next item from the ListViewItem, searching in the specified direction.

GetBounds(ItemBoundsPortion) GetBounds(ItemBoundsPortion) GetBounds(ItemBoundsPortion) GetBounds(ItemBoundsPortion)

检索项的边框的指定的部分。Retrieves the specified portion of the bounding rectangle for the item.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetSubItemAt(Int32, Int32) GetSubItemAt(Int32, Int32) GetSubItemAt(Int32, Int32) GetSubItemAt(Int32, Int32)

返回的子项ListViewItem指定坐标处。Returns the subitem of the ListViewItem at the specified coordinates.

GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
Remove() Remove() Remove() Remove()

从其关联中移除项ListView控件。Removes the item from its associated ListView control.

Serialize(SerializationInfo, StreamingContext) Serialize(SerializationInfo, StreamingContext) Serialize(SerializationInfo, StreamingContext) Serialize(SerializationInfo, StreamingContext)

序列化该项。Serializes the item.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

显式界面实现

ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext)

序列化该项。Serializes the item.

适用于

另请参阅