ListView.ColumnHeaderCollection ListView.ColumnHeaderCollection ListView.ColumnHeaderCollection ListView.ColumnHeaderCollection Class

定义

表示 ListView 控件中的列标题的集合。Represents the collection of column headers in a ListView control.

public: ref class ListView::ColumnHeaderCollection : System::Collections::IList
[System.ComponentModel.ListBindable(false)]
public class ListView.ColumnHeaderCollection : System.Collections.IList
type ListView.ColumnHeaderCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public Class ListView.ColumnHeaderCollection
Implements IList
继承
ListView.ColumnHeaderCollectionListView.ColumnHeaderCollectionListView.ColumnHeaderCollectionListView.ColumnHeaderCollection
属性
实现

示例

下面的代码示例创建一个包含窗体ListView项中的列时手动进行排序的控件ListView单击控件。The following code example creates a form that contains a ListView control that manually sorts items when a column in the ListView control is clicked. 该示例定义一个名为类ListViewItemComparer,它实现System.Collections.IComparer执行接口ListViewItem比较。The example defines a class called ListViewItemComparer that implements the System.Collections.IComparer interface that performs the ListViewItem comparison. 该示例创建的实例ListViewItemComparer并使用它来设置ListViewItemSorter属性的ListView控件。The example creates an instance of ListViewItemComparer and uses it to set the ListViewItemSorter property of the ListView control. Sort方法中调用ColumnClick事件处理程序使用中定义的方法ListViewItemComparer执行基于所单击列的项排序。The Sort method call in the ColumnClick event handler uses the methods defined in ListViewItemComparer to perform the sort of items, based on the column that is clicked.

#using <System.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>

using namespace System;
using namespace System::Windows::Forms;
using namespace System::Drawing;
using namespace System::Collections;

// Implements the manual sorting of items by columns.
ref class ListViewItemComparer: public IComparer
{
private:
   int col;

public:
   ListViewItemComparer()
   {
      col = 0;
   }

   ListViewItemComparer( int column )
   {
      col = column;
   }

   virtual int Compare( Object^ x, Object^ y )
   {
      return String::Compare( (dynamic_cast<ListViewItem^>(x))->SubItems[ col ]->Text,
                              (dynamic_cast<ListViewItem^>(y))->SubItems[ col ]->Text );
   }
};

public ref class ListViewSortForm: public Form
{
private:
   ListView^ listView1;

public:
   ListViewSortForm()
   {
      // Create ListView items to add to the control.
      array<String^>^temp0 = {"Banana","a","b","c"};
      ListViewItem^ listViewItem1 = gcnew ListViewItem( temp0,-1,Color::Empty,Color::Yellow,nullptr );
      array<String^>^temp1 = {"Cherry","v","g","t"};
      ListViewItem^ listViewItem2 = gcnew ListViewItem( temp1,-1,Color::Empty,Color::Red,
                 gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,FontStyle::Regular,GraphicsUnit::Point,0 ) );
      array<String^>^temp2 = {"Apple","h","j","n"};
      ListViewItem^ listViewItem3 = gcnew ListViewItem( temp2,-1,Color::Empty,Color::Lime,nullptr );
      array<String^>^temp3 = {"Pear","y","u","i"};
      ListViewItem^ listViewItem4 = gcnew ListViewItem( temp3,-1,Color::Empty,Color::FromArgb( 192, 128, 156 ),nullptr );

      //Initialize the ListView control and add columns to it.
      this->listView1 = gcnew ListView;

      // Set the initial sorting type for the ListView.
      this->listView1->Sorting = SortOrder::None;

      // Disable automatic sorting to enable manual sorting.
      this->listView1->View = View::Details;

      // Add columns and set their text.
      this->listView1->Columns->Add( gcnew ColumnHeader );
      this->listView1->Columns[ 0 ]->Text = "Column 1";
      this->listView1->Columns[ 0 ]->Width = 100;
      listView1->Columns->Add( gcnew ColumnHeader );
      listView1->Columns[ 1 ]->Text = "Column 2";
      listView1->Columns->Add( gcnew ColumnHeader );
      listView1->Columns[ 2 ]->Text = "Column 3";
      listView1->Columns->Add( gcnew ColumnHeader );
      listView1->Columns[ 3 ]->Text = "Column 4";

      // Suspend control logic until form is done configuring form.
      this->SuspendLayout();

      // Add Items to the ListView control.
      array<ListViewItem^>^temp4 = {listViewItem1,listViewItem2,listViewItem3,listViewItem4};
      this->listView1->Items->AddRange( temp4 );

      // Set the location and size of the ListView control.
      this->listView1->Location = Point(10,10);
      this->listView1->Name = "listView1";
      this->listView1->Size = System::Drawing::Size( 300, 100 );
      this->listView1->TabIndex = 0;

      // Enable editing of the items in the ListView.
      this->listView1->LabelEdit = true;

      // Connect the ListView::ColumnClick event to the ColumnClick event handler.
      this->listView1->ColumnClick += gcnew ColumnClickEventHandler( this, &ListViewSortForm::ColumnClick );

      // Initialize the form.
      this->ClientSize = System::Drawing::Size( 400, 400 );
      array<Control^>^temp5 = {this->listView1};
      this->Controls->AddRange( temp5 );
      this->Name = "ListViewSortForm";
      this->Text = "Sorted ListView Control";

      // Resume lay[Out] of* the form.
      this->ResumeLayout( false );
   }

private:

   // ColumnClick event handler.
   void ColumnClick( Object^ /*o*/, ColumnClickEventArgs^ e )
   {
      // Set the ListViewItemSorter property to a new ListViewItemComparer 
      // object. Setting this property immediately sorts the 
      // ListView using the ListViewItemComparer object.
      this->listView1->ListViewItemSorter = gcnew ListViewItemComparer( e->Column );
   }
};

[System::STAThreadAttribute]
int main()
{
   Application::Run( gcnew ListViewSortForm );
}
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Collections;

namespace ListViewSortFormNamespace
{
    
   
    public class ListViewSortForm : Form
    {
        private ListView listView1;
       
        public ListViewSortForm()
        {
            // Create ListView items to add to the control.
            ListViewItem listViewItem1 = new ListViewItem(new string[] {"Banana","a","b","c"}, -1, Color.Empty, Color.Yellow, null);
            ListViewItem listViewItem2 = new ListViewItem(new string[] {"Cherry","v","g","t"}, -1, Color.Empty, Color.Red, new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((System.Byte)(0))));
            ListViewItem listViewItem3 = new ListViewItem(new string[] {"Apple","h","j","n"}, -1, Color.Empty, Color.Lime, null);
            ListViewItem listViewItem4 = new ListViewItem(new string[] {"Pear","y","u","i"}, -1, Color.Empty, Color.FromArgb(((System.Byte)(192)), ((System.Byte)(128)), ((System.Byte)(156))), null);
     
            //Initialize the ListView control and add columns to it.
            this.listView1 = new ListView();

            // Set the initial sorting type for the ListView.
            this.listView1.Sorting = SortOrder.None;
            // Disable automatic sorting to enable manual sorting.
            this.listView1.View = View.Details;
            // Add columns and set their text.
            this.listView1.Columns.Add(new ColumnHeader());
            this.listView1.Columns[0].Text = "Column 1";
            this.listView1.Columns[0].Width = 100;
            listView1.Columns.Add(new ColumnHeader());
            listView1.Columns[1].Text = "Column 2";
            listView1.Columns.Add(new ColumnHeader());
            listView1.Columns[2].Text = "Column 3";
            listView1.Columns.Add(new ColumnHeader());
            listView1.Columns[3].Text = "Column 4";
            // Suspend control logic until form is done configuring form.
            this.SuspendLayout();
            // Add Items to the ListView control.
            this.listView1.Items.AddRange(new ListViewItem[] {listViewItem1,
                listViewItem2,
                listViewItem3,
                listViewItem4});
            // Set the location and size of the ListView control.
            this.listView1.Location = new Point(10, 10);
            this.listView1.Name = "listView1";
            this.listView1.Size = new Size(300, 100);
            this.listView1.TabIndex = 0;
            // Enable editing of the items in the ListView.
            this.listView1.LabelEdit = true;
            // Connect the ListView.ColumnClick event to the ColumnClick event handler.
            this.listView1.ColumnClick += new ColumnClickEventHandler(ColumnClick);
   			
            // Initialize the form.
            this.ClientSize = new Size(400, 400);
            this.Controls.AddRange(new Control[] {this.listView1});
            this.Name = "ListViewSortForm";
            this.Text = "Sorted ListView Control";
            // Resume layout of the form.
            this.ResumeLayout(false);
        }
        
	
        // ColumnClick event handler.
        private void ColumnClick(object o, ColumnClickEventArgs e)
        {
            // Set the ListViewItemSorter property to a new ListViewItemComparer 
            // object. Setting this property immediately sorts the 
            // ListView using the ListViewItemComparer object.
            this.listView1.ListViewItemSorter = new ListViewItemComparer(e.Column);
        }

        [System.STAThreadAttribute()]
        public static void Main()
        {
            Application.Run(new ListViewSortForm());
        }

    }

    // Implements the manual sorting of items by columns.
    class ListViewItemComparer : IComparer
    {
        private int col;
        public ListViewItemComparer()
        {
            col = 0;
        }
        public ListViewItemComparer(int column)
        {
            col = column;
        }
        public int Compare(object x, object y)
        {
            return String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text);
        }
    }

}
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Collections


Namespace ListViewSortFormNamespace

    Public Class ListViewSortForm
        Inherits Form

        Private listView1 As ListView

        Public Sub New()
            ' Create ListView items to add to the control.
            Dim listViewItem1 As New ListViewItem(New String() {"Banana", "a", "b", "c"}, -1, Color.Empty, Color.Yellow, Nothing)
            Dim listViewItem2 As New ListViewItem(New String() {"Cherry", "v", "g", "t"}, -1, Color.Empty, Color.Red, New Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, CType(0, System.Byte)))
            Dim listViewItem3 As New ListViewItem(New String() {"Apple", "h", "j", "n"}, -1, Color.Empty, Color.Lime, Nothing)
            Dim listViewItem4 As New ListViewItem(New String() {"Pear", "y", "u", "i"}, -1, Color.Empty, Color.FromArgb(CType(192, System.Byte), CType(128, System.Byte), CType(156, System.Byte)), Nothing)

            'Initialize the ListView control and add columns to it.
            Me.listView1 = New ListView

            ' Set the initial sorting type for the ListView.
            Me.listView1.Sorting = SortOrder.None
            ' Disable automatic sorting to enable manual sorting.
            Me.listView1.View = View.Details
            ' Add columns and set their text.
            Me.listView1.Columns.Add(New ColumnHeader)
            Me.listView1.Columns(0).Text = "Column 1"
            Me.listView1.Columns(0).Width = 100
            listView1.Columns.Add(New ColumnHeader)
            listView1.Columns(1).Text = "Column 2"
            listView1.Columns.Add(New ColumnHeader)
            listView1.Columns(2).Text = "Column 3"
            listView1.Columns.Add(New ColumnHeader)
            listView1.Columns(3).Text = "Column 4"
            ' Suspend control logic until form is done configuring form.
            Me.SuspendLayout()
            ' Add Items to the ListView control.
            Me.listView1.Items.AddRange(New ListViewItem() {listViewItem1, listViewItem2, listViewItem3, listViewItem4})
            ' Set the location and size of the ListView control.
            Me.listView1.Location = New Point(10, 10)
            Me.listView1.Name = "listView1"
            Me.listView1.Size = New Size(300, 100)
            Me.listView1.TabIndex = 0
            ' Enable editing of the items in the ListView.
            Me.listView1.LabelEdit = True
            ' Connect the ListView.ColumnClick event to the ColumnClick event handler.
            AddHandler Me.listView1.ColumnClick, AddressOf ColumnClick

            ' Initialize the form.
            Me.ClientSize = New Size(400, 400)
            Me.Controls.AddRange(New Control() {Me.listView1})
            Me.Name = "ListViewSortForm"
            Me.Text = "Sorted ListView Control"
            ' Resume layout of the form.
            Me.ResumeLayout(False)
        End Sub 'New


        ' ColumnClick event handler.
        Private Sub ColumnClick(ByVal o As Object, ByVal e As ColumnClickEventArgs)
            ' Set the ListViewItemSorter property to a new ListViewItemComparer 
            ' object. Setting this property immediately sorts the 
            ' ListView using the ListViewItemComparer object.
            Me.listView1.ListViewItemSorter = New ListViewItemComparer(e.Column)
        End Sub

    End Class

    ' Implements the manual sorting of items by columns.
    Class ListViewItemComparer
        Implements IComparer

        Private col As Integer

        Public Sub New()
            col = 0
        End Sub

        Public Sub New(ByVal column As Integer)
            col = column
        End Sub

        Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer _
           Implements IComparer.Compare
            Return [String].Compare(CType(x, ListViewItem).SubItems(col).Text, CType(y, ListViewItem).SubItems(col).Text)
        End Function
    End Class
End Namespace

注解

一个ListView.ColumnHeaderCollection类存储中显示的列标题ListView控制何时View属性设置为DetailsA ListView.ColumnHeaderCollection class stores the column headers that are displayed in the ListView control when the View property is set to Details. ListView.ColumnHeaderCollection存储ColumnHeader对象以定义要如何中显示列标题的列以及显示的文本ListView控制时显示的列。The ListView.ColumnHeaderCollection stores ColumnHeader objects that define the text to display for a column as well as how the column header is displayed in the ListView control when displaying columns. ListView显示列、 项和其子项显示在自己的列。When a ListView displays columns, the items and their subitems are displayed in their own columns. 若要指定哪些列下显示子项数据,请参阅ListViewItem.ListViewSubItemCollection类。To specify which columns subitem data is displayed under, see the ListViewItem.ListViewSubItemCollection class.

有多种方法来将列标题添加到集合。There are a number of ways to add column headers to the collection. Add方法向集合添加一个列标题。The Add method adds a single column header to the collection. 若要向集合添加多个列标题,您创建的数组ColumnHeader对象,并将其传递给AddRange方法。To add a number of column headers to the collection, you create an array of ColumnHeader objects and pass it to the AddRange method. 如果你想要在集合中的特定位置插入列标题,则可以使用Insert方法。If you want to insert a column header at a specific location in the collection, you can use the Insert method. 若要删除列标题,可以使用任一Remove方法或RemoveAt方法如果你知道列标题在集合中的位置。To remove column headers, you can use either the Remove method or the RemoveAt method if you know where the column header is located in the collection. Clear方法,可从而不是使用集合中移除所有列标题Remove方法一次都删除一个列标题。The Clear method allows you to remove all column headers from the collection instead of using the Remove method to remove a single column header at a time.

除了方法和属性用于添加和删除列标题ListView.ColumnHeaderCollection还提供了在集合中查找列标题的方法。In addition to methods and properties for adding and removing column headers, the ListView.ColumnHeaderCollection also provides methods to find column headers in the collection. Contains方法使您可以确定列标题是否为集合的成员。The Contains method enables you to determine whether a column header is a member of the collection. 一旦您知道列标头存储在集合中,可以使用IndexOf方法,以确定列标题在集合中的位置。Once you know that the column header is located in the collection, you can use the IndexOf method to determine where the column header is located in the collection.

备注

当所有列的总的宽度超过 32768 个像素时则会导致意外的行为。Unexpected behavior can result when the combined width of all columns exceeds 32,768 pixels.

构造函数

ListView.ColumnHeaderCollection(ListView) ListView.ColumnHeaderCollection(ListView) ListView.ColumnHeaderCollection(ListView) ListView.ColumnHeaderCollection(ListView)

初始化 ListView.ColumnHeaderCollection 类的新实例。Initializes a new instance of the ListView.ColumnHeaderCollection class.

属性

Count Count Count Count

获取集合中的项数。Gets the number of items in the collection.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

获取一个值,该值指示集合是否为只读。Gets a value indicating whether the collection is read-only.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

获取集合中指定索引处的列标题。Gets the column header at the specified index within the collection.

Item[String] Item[String] Item[String] Item[String]

获取集合中具有指定键的列标题。Gets the column header with the specified key from the collection.

方法

Add(ColumnHeader) Add(ColumnHeader) Add(ColumnHeader) Add(ColumnHeader)

将现有的 ColumnHeader 添加到集合中。Adds an existing ColumnHeader to the collection.

Add(String) Add(String) Add(String) Add(String)

创建具有指定文本的列并将其添加到集合。Creates and adds a column with the specified text to the collection.

Add(String, Int32) Add(String, Int32) Add(String, Int32) Add(String, Int32)

创建具有指定的文本和宽度的列并将其添加到集合。Creates and adds a column with the specified text and width to the collection.

Add(String, Int32, HorizontalAlignment) Add(String, Int32, HorizontalAlignment) Add(String, Int32, HorizontalAlignment) Add(String, Int32, HorizontalAlignment)

将列标题添至具有指定文本、宽度和对齐方式设置的集合。Adds a column header to the collection with specified text, width, and alignment settings.

Add(String, String) Add(String, String) Add(String, String) Add(String, String)

创建具有指定的文本和键的列并将其添加到集合。Creates and adds a column with the specified text and key to the collection.

Add(String, String, Int32) Add(String, String, Int32) Add(String, String, Int32) Add(String, String, Int32)

创建具有指定的文本、键和宽度的列并将其添加到集合。Creates and adds a column with the specified text, key, and width to the collection.

Add(String, String, Int32, HorizontalAlignment, Int32) Add(String, String, Int32, HorizontalAlignment, Int32) Add(String, String, Int32, HorizontalAlignment, Int32) Add(String, String, Int32, HorizontalAlignment, Int32)

创建具有指定键、对齐文本、宽度和图像索引的列并将其添加到集合。Creates and adds a column with the specified key, aligned text, width, and image index to the collection.

Add(String, String, Int32, HorizontalAlignment, String) Add(String, String, Int32, HorizontalAlignment, String) Add(String, String, Int32, HorizontalAlignment, String) Add(String, String, Int32, HorizontalAlignment, String)

创建具有指定键、对齐文本、宽度和图像键的列并将其添加到集合。Creates and adds a column with the specified key, aligned text, width, and image key to the collection.

AddRange(ColumnHeader[]) AddRange(ColumnHeader[]) AddRange(ColumnHeader[]) AddRange(ColumnHeader[])

给集合添加列标题数组。Adds an array of column headers to the collection.

Clear() Clear() Clear() Clear()

从集合中移除所有列标题。Removes all column headers from the collection.

Contains(ColumnHeader) Contains(ColumnHeader) Contains(ColumnHeader) Contains(ColumnHeader)

确定指定列标题是否位于集合内。Determines whether the specified column header is located in the collection.

ContainsKey(String) ContainsKey(String) ContainsKey(String) ContainsKey(String)

确定具有指定键的列是否包含在集合中。Determines if a column with the specified key is contained in the collection.

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

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

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回要用于循环访问列标题集合的枚举数。Returns an enumerator to use to iterate through the column header collection.

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

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

(Inherited from Object)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
IndexOf(ColumnHeader) IndexOf(ColumnHeader) IndexOf(ColumnHeader) IndexOf(ColumnHeader)

返回指定的列标题在集合中的索引。Returns the index, within the collection, of the specified column header.

IndexOfKey(String) IndexOfKey(String) IndexOfKey(String) IndexOfKey(String)

确定具有指定键的列的索引。Determines the index for a column with the specified key.

Insert(Int32, ColumnHeader) Insert(Int32, ColumnHeader) Insert(Int32, ColumnHeader) Insert(Int32, ColumnHeader)

将现有的列标题插入到集合中的指定索引位置。Inserts an existing column header into the collection at the specified index.

Insert(Int32, String) Insert(Int32, String) Insert(Int32, String) Insert(Int32, String)

创建具有指定文本的新列标题,并将其插入到集合中指定索引处。Creates a new column header with the specified text, and inserts the header into the collection at the specified index.

Insert(Int32, String, Int32) Insert(Int32, String, Int32) Insert(Int32, String, Int32) Insert(Int32, String, Int32)

创建具有指定文本和初始宽度的新列标题,并将其插入到集合中指定索引处。Creates a new column header with the specified text and initial width, and inserts the header into the collection at the specified index.

Insert(Int32, String, Int32, HorizontalAlignment) Insert(Int32, String, Int32, HorizontalAlignment) Insert(Int32, String, Int32, HorizontalAlignment) Insert(Int32, String, Int32, HorizontalAlignment)

新建列标题并将它插入集合中的指定索引位置。Creates a new column header and inserts it into the collection at the specified index.

Insert(Int32, String, String) Insert(Int32, String, String) Insert(Int32, String, String) Insert(Int32, String, String)

创建具有指定的文本和键的新列标题,并将其插入到集合中指定索引处。Creates a new column header with the specified text and key, and inserts the header into the collection at the specified index.

Insert(Int32, String, String, Int32) Insert(Int32, String, String, Int32) Insert(Int32, String, String, Int32) Insert(Int32, String, String, Int32)

创建具有指定的文本、键和宽度的新列标题,并将其插入到集合中指定索引处。Creates a new column header with the specified text, key, and width, and inserts the header into the collection at the specified index.

Insert(Int32, String, String, Int32, HorizontalAlignment, Int32) Insert(Int32, String, String, Int32, HorizontalAlignment, Int32) Insert(Int32, String, String, Int32, HorizontalAlignment, Int32) Insert(Int32, String, String, Int32, HorizontalAlignment, Int32)

创建具有指定的对齐文本、键、宽度和图像索引的新列标题,并将其插入到集合中指定索引处。Creates a new column header with the specified aligned text, key, width, and image index, and inserts the header into the collection at the specified index.

Insert(Int32, String, String, Int32, HorizontalAlignment, String) Insert(Int32, String, String, Int32, HorizontalAlignment, String) Insert(Int32, String, String, Int32, HorizontalAlignment, String) Insert(Int32, String, String, Int32, HorizontalAlignment, String)

创建具有指定的对齐文本、键、宽度和图像键的新列标题,并将其插入到集合中指定索引处。Creates a new column header with the specified aligned text, key, width, and image key, and inserts the header into the collection at the specified index.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

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

从集合中移除指定的列标题。Removes the specified column header from the collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

移除集合中指定索引处的列标题。Removes the column header at the specified index within the collection.

RemoveByKey(String) RemoveByKey(String) RemoveByKey(String) RemoveByKey(String)

从集合中移除具有指定键的列。Removes the column with the specified key from the collection.

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

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

(Inherited from Object)

显式界面实现

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

ColumnHeader 中的 ListView.ColumnHeaderCollection 对象复制到一个数组中从特定的数组索引开始的位置。Copies the ColumnHeader objects in the ListView.ColumnHeaderCollection to an array, starting at a particular array index.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

获取一个值,该值指示是否同步对 ListView.ColumnHeaderCollection 的访问(线程安全)。Gets a value indicating whether access to the ListView.ColumnHeaderCollection is synchronized (thread safe).

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

获取可用于同步控件集合访问的对象。Gets an object that can be used to synchronize access to the collection of controls.

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

ColumnHeader 中添加一个 ListViewAdds a ColumnHeader to the ListView.

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

确定指定列标题是否位于集合内。Determines whether the specified column header is located in the collection.

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

返回指定的列标题在集合中的索引。Returns the index, within the collection, of the specified column header.

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

将现有的列标题插入到集合中的指定索引位置。Inserts an existing column header into the collection at the specified index.

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

获取一个值,该值指示 ListView.ColumnHeaderCollection 是否具有固定大小。Gets a value indicating whether the ListView.ColumnHeaderCollection has a fixed size.

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

在集合中的指定索引处获取或设置列标题。Gets or sets the column header at the specified index within the collection.

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

从集合中移除指定的列标题。Removes the specified column header from the collection.

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

将转换IEnumerableIQueryableConverts an IEnumerable to an IQueryable.

适用于