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為、 MySmallImage2MyLargeImage1MyLargeImage2的映射位於磁片磁碟機 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. 類別會定義與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. LargeImageList ListView ImageList ListView屬性可讓您指定要從指派給控制項的載入的影像 (藉由設定的或SmallImageList屬性)。 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當相關聯ListView控制項的屬性設定為Details ListView.ColumnHeaderCollection , 且在控制項的中定義資料行時, 專案可以顯示任意數目的子項。 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. 方法會將專案的文字放入編輯模式, 讓使用者可以變更專案的文字 ( LabelEditListView控制項的屬性設定為true時)。 BeginEditThe 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 的淺層複本 (Shallow Copy)。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.

適用於

另請參閱