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 Form 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)

建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。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()

擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。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 的淺層複本 (Shallow Copy)。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.

Extension Methods

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.

適用於

另請參閱