Control.ControlCollection.Item[] 属性

定义

指示集合中的一个 ControlIndicates a Control in the collection.

重载

Item[Int32]

指示位于集合中指定索引位置的 ControlIndicates the Control at the specified indexed location in the collection.

Item[String]

指示集合中具有指定键的一个 ControlIndicates a Control with the specified key in the collection.

Item[Int32]

指示位于集合中指定索引位置的 ControlIndicates the Control at the specified indexed location in the collection.

public:
 virtual property System::Windows::Forms::Control ^ default[int] { System::Windows::Forms::Control ^ get(int index); };
public virtual System.Windows.Forms.Control this[int index] { get; }
member this.Item(int) : System.Windows.Forms.Control
Default Public Overridable ReadOnly Property Item(index As Integer) As Control

参数

index
Int32

要从控件集合中检索的控件索引。The index of the control to retrieve from the control collection.

属性值

Control

位于控件集合内指定索引位置的 ControlThe Control located at the specified index location within the control collection.

例外

index 值小于零或者大于等于集合中控件的数量。The index value is less than zero or is greater than or equal to the number of controls in the collection.

注解

若要从 Control.ControlCollection中检索 Control,请引用具有特定索引值的集合对象。To retrieve a Control from the Control.ControlCollection, reference the collection object with a specific index value. Control.ControlCollection 的索引值是从零开始的索引。The index value of the Control.ControlCollection is a zero-based index.

另请参阅

Item[String]

指示集合中具有指定键的一个 ControlIndicates a Control with the specified key in the collection.

public:
 virtual property System::Windows::Forms::Control ^ default[System::String ^] { System::Windows::Forms::Control ^ get(System::String ^ key); };
public virtual System.Windows.Forms.Control this[string key] { get; }
member this.Item(string) : System.Windows.Forms.Control
Default Public Overridable ReadOnly Property Item(key As String) As Control

参数

key
String

要从控件集合中检索的控件的名称。The name of the control to retrieve from the control collection.

属性值

Control

Control 中具有指定键的 Control.ControlCollectionThe Control with the specified key within the Control.ControlCollection.

注解

ControlName 属性对应于 Control.ControlCollectionControl 的键。The Name property of a Control corresponds to the key for a Control in the Control.ControlCollection.

适用于