共用方式為


ShapeCollection.Item 屬性

取得Shape在指定索引的集合中的位置。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
Public Property Item ( _
    index As Integer _
) As Object
public Object this[
    int index
] { get; set; }
public:
virtual property Object^ Item[int index] {
    Object^ get (int index) sealed;
    void set (int index, Object^ value) sealed;
}
abstract Item : Object with get, set
override Item : Object with get, set
JScript 不支援索引屬性。

參數

屬性值

型別:System.Object
Shape 位於指定的索引位置,在ShapeCollection

實作

IList.Item

備註

若要擷取ShapeShapeCollection,使用特定的索引值參考的集合物件。ShapeCollection 的索引值是以零起始的索引。

範例

下列範例會使用Index的ShapeCollection將焦點設定到圖形。這個範例要求您必須ButtonLineShapeOvalShape,以及RectangleShape在表單上的控制項。

Private Sub Button1_Click() Handles Button1.Click
    ' Set the focus to the first shape (index 0).
    ShapeContainer1.Shapes.Item(0).Focus()
End Sub
private void button1_Click(System.Object sender, System.EventArgs e)
{
    // Set the focus to the first shape (index 0).
    Shape selectedShape = ((Shape) shapeContainer1.Shapes.get_Item(0));
    selectedShape.Focus();
}

.NET Framework 安全性

請參閱

參考

ShapeCollection 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

Line 和 Shape 控制項簡介 (Visual Studio)

HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)

HOW TO:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)