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 :
index:int -> Object with get, set
override Item :
index:int -> Object with get, set
JScript では、インデックス付きプロパティはサポートされません。
パラメーター
index
型 : Int32ShapeCollection から取得する図形のインデックス。
プロパティ値
型 : Object
ShapeCollection 内の指定されたインデックス位置にある Shape。
実装
IList.Item
解説
ShapeCollectionから Shape を取得するには、特定のインデックス値を使用してコレクション オブジェクトを参照します。 ShapeCollection のインデックス値は 0 から始まるインデックスです。
例
次の例は、図形にフォーカスを設定するには ShapeCollection の Index を使用します。 この例では、フォームの Button、LineShape、OvalShapeと 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 セキュリティ
- 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。
参照
関連項目
Microsoft.VisualBasic.PowerPacks 名前空間
その他の技術情報
ライン コントロールとシェイプ コントロールの概要 (Visual Studio)
方法 : LineShape コントロールを使用して線を描画する (Visual Studio)
方法 : OvalShape コントロールおよび RectangleShape コントロールを使用して図形を描画する (Visual Studio)