CustomStrokes コレクション内の指定されたインデックス位置にある Strokes コレクションを取得します。
名前空間 : Microsoft.Ink
アセンブリ : Microsoft.Ink (Microsoft.Ink.dll 内)
構文
'宣言
Public ReadOnly Property Item ( _
index As Integer _
) As Strokes
'使用
Dim instance As CustomStrokes
Dim index As Integer
Dim value As Strokes
value = instance.Item(index)
public Strokes Item[
int index
] { get; }
public:
property Strokes^ Item[int index] {
Strokes^ get (int index);
}
/** @property */
public Strokes get_Item(
int index
)
JScript では、インデックス付きプロパティはサポートされません。
パラメータ
- index
型 : System.Int32
取得する Strokes コレクションの、0 から始まるインデックス。
プロパティ値
型 : Microsoft.Ink.Strokes
CustomStrokes コレクション内の指定した Strokes コレクション。
解説
index が CustomStrokes コレクションの既存のメンバと一致しない場合は System.ArgumentOutOfRangeException が発生します。開発目的で、Tablet Edition ではなく、Tablet PC SDK がインストールされている Windows XP を使用していて、index が CustomStrokes コレクションの既存のメンバと一致しない場合は System.Runtime.Inter が発生します。
![]() |
---|
C# では、次の例に示すように、コレクションの Item プロパティを使用する代わりに、コレクションのインデクサを使用します。 |
例
この例では、Ink オブジェクトの CustomStrokes コレクションの指定されたインデックスに、Strokes コレクションが含まれている場合に、メソッドが true を返します。指定されたインデックスに Strokes コレクションが存在しない場合は、例外が発生し、メソッドが false を返します。
Private Function CustomStrokesCollectionExists(ByVal mIndex As Integer, ByVal mInk As Ink) As Boolean
Try
Dim S As Strokes = mInk.CustomStrokes(mIndex)
' In VB, you can also access the named collections by using the Item property:
' Dim S As Strokes = mInk.CustomStrokes.Item(mIndex)
'
' if the previous statement did not raise an exception,
' the indexed Strokes collection exists
Return True
Catch E As System.Runtime.InteropServices.COMException
' For Windows XP (not Tablet Edition) with Tablet PC SDK installed for development purposes
' this exception is raised when the indexed collection does not exist
Catch E As ArgumentOutOfRangeException
' For Windows XP Tablet Edition and Vista
' this exception is raised when the indexed collection does not exist
Catch E As Exception
' in case another type of exception is raised
End Try
Return False
End Function
private bool CustomStrokesCollectionExists(int mIndex, Ink mInk)
{
try
{
Strokes S = mInk.CustomStrokes[mIndex];
// In C#, the Item property is not available. The following won't compile:
// Strokes S = mInk.CustomStrokes.Item[mIndex];
// if the previous statement did not throw an exception,
// the indexed Strokes collection exists
return true;
}
catch (System.Runtime.InteropServices.COMException)
{
// For Windows XP (not Tablet Edition) with Tablet PC SDK installed for development purposes
// this exception is raised when the indexed collection does not exist
}
catch (ArgumentOutOfRangeException)
{
// For Windows XP Tablet Edition and Vista
// this exception is raised when the indexed collection does not exist
}
catch (Exception)
{
// in case another type of exception is raised
}
return false;
}
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0