Freigeben über


CustomStrokes.Item-Eigenschaft (Int32)

Ruft die Strokes-Auflistung ab, die am angegebenen Index in der CustomStrokes-Auflistung gespeichert ist.

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 Item[
    int index
] { get; }
public:
property Strokes^ Item[int index] {
    Strokes^ get (int index);
}
/** @property */
public Strokes get_Item(
    int index
)
JScript unterstützt keine indizierten Eigenschaften.

Parameter

Eigenschaftenwert

Typ: Microsoft.Ink.Strokes
Die angegebene Strokes-Auflistung in der CustomStrokes-Auflistung.

Hinweise

Eine System.ArgumentOutOfRangeException wird ausgelöst, wenn der Parameter index keinem vorhandenen Member der CustomStrokes-Auflistung entspricht. Wenn Sie für Entwicklungszwecke Windows XP (nicht die Tablet Edition) mit installiertem Tablet PC SDK verwenden und der Parameter index keinem vorhandenen Member der CustomStrokes-Auflistung entspricht, wird eine System.Runtime.InteropServices-Ausnahme ausgelöst.

Hinweis

Verwenden Sie in C# anstelle der Item-Eigenschaft der Auflistung den Indexer der Auflistung, wie im folgenden Beispiel gezeigt.

Beispiele

In diesem Beispiel wird von einer Methode true zurückgegeben, wenn die CustomStrokes-Auflistung eines Ink-Objekts eine Strokes-Auflistung unter dem angegebenen Index enthält. Wenn keine Strokes-Auflistung unter dem angegebenen Index vorhanden ist, wird eine Ausnahme ausgelöst und die Methode gibt false zurück.

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;
}

Plattformen

Windows Vista

.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.

Versionsinformationen

.NET Framework

Unterstützt in: 3.0

Siehe auch

Referenz

CustomStrokes-Klasse

CustomStrokes-Member

Item-Überladung

Microsoft.Ink-Namespace

Item

Strokes