ShapeCollection.Item Property

Gets the Shape at the specified indexed location in the collection.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
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 : 
        index:int -> Object with get, set 
override Item : 
        index:int -> Object with get, set
JScript does not support indexed properties.

Parameters

Property Value

Type: System.Object
The Shape located at the specified index location in the ShapeCollection.

Implements

IList.Item

Remarks

To retrieve a Shape from the ShapeCollection, reference the collection object by using a specific index value. The index value of the ShapeCollection is a zero-based index.

Examples

The following example uses the Index of a ShapeCollection to set the focus to a shape. This example requires that you have a Button, a LineShape, an OvalShape, and a RectangleShape control on a form.

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 Security

See Also

Reference

ShapeCollection Class

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

Introduction to the Line and Shape Controls (Visual Studio)

How to: Draw Lines with the LineShape Control (Visual Studio)

How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)