CustomStrokes.Item Property (Int32)
Gets the Strokes collection at the specified index within the CustomStrokes collection.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
Syntax
'Declaration
Public ReadOnly Property Item ( _
index As Integer _
) As Strokes
'Usage
Dim instance As CustomStrokes
Dim index As Integer
Dim value As Strokes
value = instance.Item(index)
public Strokes this[
int index
] { get; }
public:
property Strokes^ Item[int index] {
Strokes^ get (int index);
}
JScript does not support indexed properties.
Parameters
index
Type: System.Int32The zero-based index of the Strokes collection to get.
Property Value
Type: Microsoft.Ink.Strokes
The specified Strokes collection within the CustomStrokes collection.
Remarks
A System.ArgumentOutOfRangeException is raised if the index does not match an existing member of the CustomStrokes collection. If for development purposes you are using Windows XP (not the Tablet Edition) with the Tablet PC SDK installed and the index does not match an existing member of the CustomStrokes collection, a System.Runtime.Inter o pServices .COMException is raised.
Note
In C#, use the collection's indexer as shown in the following example, instead of using the collection's Item property.
Examples
In this example, a method returns true if the CustomStrokes collection of an Ink object contains a Strokes collection at the specified index. If a Strokes collection does not exist at the specified index, an exception is raised and the method returns 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;
}
Platforms
Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information
.NET Framework
Supported in: 3.0