DataGridViewCellCollection DataGridViewCellCollection DataGridViewCellCollection DataGridViewCellCollection Class

定义

表示 DataGridViewRow 中单元格的集合。Represents a collection of cells in a DataGridViewRow.

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

注解

DataGridViewCellCollection对象由DataGridViewRow.Cells属性检索。DataGridViewCellCollection objects are retrieved by the DataGridViewRow.Cells property.

构造函数

DataGridViewCellCollection(DataGridViewRow) DataGridViewCellCollection(DataGridViewRow) DataGridViewCellCollection(DataGridViewRow) DataGridViewCellCollection(DataGridViewRow)

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

属性

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 or sets the cell at the provided index location. 在 C# 中,此属性是 DataGridViewCellCollection 类的索引器。In C#, this property is the indexer for the DataGridViewCellCollection class.

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

获取或设置具有所提供名称的列中的单元格。Gets or sets the cell in the column with the provided name. 在 C# 中,此属性是 DataGridViewCellCollection 类的索引器。In C#, this property is the indexer for the DataGridViewCellCollection class.

List List List List

获取包含 ArrayList 对象的 DataGridViewCellCollectionGets an ArrayList containing DataGridViewCellCollection objects.

SyncRoot SyncRoot SyncRoot SyncRoot

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

(Inherited from BaseCollection)

方法

Add(DataGridViewCell) Add(DataGridViewCell) Add(DataGridViewCell) Add(DataGridViewCell)

向集合中添加一个单元格。Adds a cell to the collection.

AddRange(DataGridViewCell[]) AddRange(DataGridViewCell[]) AddRange(DataGridViewCell[]) AddRange(DataGridViewCell[])

向集合中添加单元格的数组。Adds an array of cells to the collection.

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

清除集合中的所有单元格。Clears all cells from the collection.

Contains(DataGridViewCell) Contains(DataGridViewCell) Contains(DataGridViewCell) Contains(DataGridViewCell)

确定指定的单元格是否包含在集合中。Determines whether the specified cell 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(DataGridViewCell[], Int32) CopyTo(DataGridViewCell[], Int32) CopyTo(DataGridViewCell[], Int32) CopyTo(DataGridViewCell[], Int32)

将单元格的整个集合复制到一个数组中,从该数组内的指定位置开始复制。Copies the entire collection of cells into an array at a specified location within the array.

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)
IndexOf(DataGridViewCell) IndexOf(DataGridViewCell) IndexOf(DataGridViewCell) IndexOf(DataGridViewCell)

返回指定单元格的索引。Returns the index of the specified cell.

InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

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

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

将单元格插入到集合中的指定索引位置。Inserts a cell into the collection at the specified index.

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)
OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs)

引发 CollectionChanged 事件。Raises the CollectionChanged event.

Remove(DataGridViewCell) Remove(DataGridViewCell) Remove(DataGridViewCell) Remove(DataGridViewCell)

从集合中移除指定的单元格。Removes the specified cell from the collection.

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

移除指定索引处的单元格。Removes the cell at the specified index.

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

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

(Inherited from Object)

事件

CollectionChanged CollectionChanged CollectionChanged CollectionChanged

当集合更改时发生。Occurs when the collection is changed.

显式界面实现

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

向集合中添加一项。Adds an item to the collection.

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

清除集合。Clears the collection.

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

确定集合是否包含指定的值。Determines whether the collection contains the specified value.

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

确定集合中特定项的索引。Determines the index of a specific item in a collection.

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

将一项插入到集合中的指定位置。Inserts an item into the collection at the specified position.

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 has a fixed size.

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

获取或设置指定索引处的元素。Gets or sets the element at the specified index.

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

从集合中移除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the collection.

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

移除位于指定索引处的 DataGridViewCellRemoves the DataGridViewCell at the specified index.

扩展方法

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.

适用于

另请参阅