DataGridViewSelectedColumnCollection DataGridViewSelectedColumnCollection DataGridViewSelectedColumnCollection DataGridViewSelectedColumnCollection Class

定义

表示在 DataGridViewColumn 中选定的 DataGridView 对象集合。Represents a collection of DataGridViewColumn objects that are selected in a DataGridView.

public ref class DataGridViewSelectedColumnCollection : System::Windows::Forms::BaseCollection, System::Collections::IList
[System.ComponentModel.ListBindable(false)]
public class DataGridViewSelectedColumnCollection : System.Windows.Forms.BaseCollection, System.Collections.IList
type DataGridViewSelectedColumnCollection = class
    inherit BaseCollection
    interface IList
    interface ICollection
    interface IEnumerable
Public Class DataGridViewSelectedColumnCollection
Inherits BaseCollection
Implements IList
继承
DataGridViewSelectedColumnCollectionDataGridViewSelectedColumnCollectionDataGridViewSelectedColumnCollectionDataGridViewSelectedColumnCollection
属性
实现

注解

不保证集合中列的顺序与选择它们的顺序相匹配。The order of columns in the collection is not guaranteed to match the order in which they were selected.

DataGridViewSelectedColumnCollection使用大量列时, 不能有效地执行。The DataGridViewSelectedColumnCollection does not perform efficiently when working with large numbers of columns. 通常, DataGridView控件将不包含足够的列来解决此问题, 但如果使用的是大量的列, 则可以DataGridView.AreAllCellsSelected使用来确定是否选择了整个网格, DataGridViewColumnCollection.GetColumnCount或者可以使用来确定选定列数 (或指定状态中的列数)。Typically, DataGridView controls will not contain enough columns for this to be an issue, but if you are working with large numbers of columns, you can use the DataGridView.AreAllCellsSelected to determine if the entire grid is selected, or you can use the DataGridViewColumnCollection.GetColumnCount to determine the number of selected columns (or the number of columns in a specified state). 有关详细信息,请参阅 缩放 Windows 窗体 DataGridView 控件的最佳做法For more information, see Best Practices for Scaling the Windows Forms DataGridView Control.

属性

Count Count Count Count

获取集合中元素的总数。Gets the total number of elements in the collection.

(Inherited from BaseCollection)
IsReadOnly IsReadOnly IsReadOnly IsReadOnly

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

(Inherited from BaseCollection)
IsSynchronized IsSynchronized IsSynchronized IsSynchronized

获取一个值,该值指示对 ICollection 的访问是否同步。Gets a value indicating whether access to the ICollection is synchronized.

(Inherited from BaseCollection)
Item[Int32] Item[Int32] Item[Int32] Item[Int32]

获取指定索引处的列。Gets the column at the specified index.

List List List List

获取包含在 BaseCollection 实例中的元素的列表。Gets the list of elements contained in the BaseCollection instance.

SyncRoot SyncRoot SyncRoot SyncRoot

获取可用于同步对 BaseCollection 的访问的对象。Gets an object that can be used to synchronize access to the BaseCollection.

(Inherited from BaseCollection)

方法

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

清除集合。Clears the collection.

Contains(DataGridViewColumn) Contains(DataGridViewColumn) Contains(DataGridViewColumn) Contains(DataGridViewColumn)

确定指定的列是否包含在集合中。Determines whether the specified column is contained in the collection.

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

将当前一维 Array 的所有元素复制到指定的一维 Array 中(从指定的目标 Array 索引开始)。Copies all the elements of the current one-dimensional Array to the specified one-dimensional Array starting at the specified destination Array index.

(Inherited from BaseCollection)
CopyTo(DataGridViewColumn[], Int32) CopyTo(DataGridViewColumn[], Int32) CopyTo(DataGridViewColumn[], Int32) CopyTo(DataGridViewColumn[], Int32)

从指定索引处开始,将集合中的元素复制到指定的数组。Copies the elements of the collection to the specified array, starting at the specified index.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
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()

获取能够循环访问集合成员的对象。Gets the object that enables iterating through the members of the collection.

(Inherited from BaseCollection)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
Insert(Int32, DataGridViewColumn) Insert(Int32, DataGridViewColumn) Insert(Int32, DataGridViewColumn) Insert(Int32, DataGridViewColumn)

将列插入到集合中的指定位置。Inserts a column into the collection at the specified position.

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

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

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

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
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)

从指定索引处开始,将集合中的元素复制到指定的数组。Copies the elements of the collection to the specified array, starting at the specified index.

ICollection.Count ICollection.Count ICollection.Count ICollection.Count

获取集合中的元素数。Gets the number of elements in the collection.

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

获取一个值,该值指示对集合的访问是否为同步的(线程安全)。Gets a value indicating whether access to the collection 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.

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

返回循环访问集合的枚举数。Returns an enumerator that iterates through a collection.

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

实现 Add(Object) 方法。Implements the Add(Object) method. 总是引发 NotSupportedExceptionAlways throws NotSupportedException.

IList.Clear() IList.Clear() IList.Clear() IList.Clear()

实现 Clear() 方法。Implements the Clear() method. 总是引发 NotSupportedExceptionAlways throws NotSupportedException.

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

确定指定的值是否包含在集合中。Determines whether the specified value is contained in the collection.

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

返回指定元素的索引。Returns the index of the specified element.

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

实现 Insert(Int32, Object) 方法。Implements the Insert(Int32, Object) method. 总是引发 NotSupportedExceptionAlways throws NotSupportedException.

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

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

IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly

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

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

获取指定索引处的元素。Gets the element at the specified index.

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

实现 Remove(Object) 方法。Implements the Remove(Object) method. 总是引发 NotSupportedExceptionAlways throws NotSupportedException.

IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32)

实现 RemoveAt(Int32) 方法。Implements the RemoveAt(Int32) method. 总是引发 NotSupportedExceptionAlways throws NotSupportedException.

扩展方法

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)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于

另请参阅