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对象将添加LargeImageList到和SmallImageList属性。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. 该示例要求MySmallImage1名为MyLargeImage1MySmallImage2、和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

注解

该控件类似ListBox于, 其中显示项列表。 ListViewThe 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. 类定义与ListView控件中显示的项相关联的外观、行为和数据。 ListViewItemThe 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. 、和属性允许您更改项的ListView文本在控件中的显示方式。 Font ForeColor BackColorThe BackColor, ForeColor, and Font properties allow you to change how the text of the item is displayed in the ListView control. ImageList LargeImageList ListView SmallImageList属性允许你指定要从分配给控件的ListView(通过设置的或属性) 加载的图像。 ImageIndexThe 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当关联Details ListView.ColumnHeaderCollection控件的属性设置为ListView , 并且在控件的中定义了列时, 项可以显示任意数量的子项。 ListViewItems 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. 属性允许你获取对类及其成员的ListViewItem.ListViewSubItemCollection访问权限。 SubItemsThe 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.

类还提供了不是方法版本的ListView方法。 ListViewItemThe ListViewItem class also provides methods that are not versions of ListView methods. BeginEdit方法将项的文本置于编辑模式, 以便用户可以更改项的文本 (将ListView控件的LabelEdit属性设置为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). 使用方法可以创建现有ListViewItem对象的副本, 以便在其他ListView控件中重复使用。 CloneThe 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

获取或设置 ListViewItem 要缩进的小图像宽度的数量。Gets 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

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

Position Position Position Position

获取或设置 ListViewItem 的左上角的位置。Gets 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

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

UseItemStyleForSubItems UseItemStyleForSubItems UseItemStyleForSubItems UseItemStyleForSubItems

获取或设置一个值,该值指示项的 FontForeColorBackColor 属性是否用于其所有子项。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.

适用于

另请参阅