Condividi tramite


Proprietà CustomStrokes.Item (Int32)

Aggiornamento: novembre 2007

Ottiene l'insieme Strokes in corrispondenza dell'indice specificato all'interno dell'insieme CustomStrokes.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Sintassi

'Dichiarazione
Public ReadOnly Property Item ( _
    index As Integer _
) As Strokes
'Utilizzo
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 non supporta le proprietà indicizzate.

Parametri

Valore proprietà

Tipo: Microsoft.Ink.Strokes
Insieme Strokes specificato all'interno dell'insieme CustomStrokes.

Note

Se il parametro index non corrisponde a un membro esistente dell'insieme CustomStrokes, viene generata un'eccezione System.ArgumentOutOfRangeException. Se si utilizza Windows XP (e non Tablet Edition) per scopi di sviluppo con l'SDK di Tablet PC installato e il parametro index non corrisponde a un membro esistente dell'insieme CustomStrokes, viene generata un'eccezione System.Runtime.Inter.

Nota

In C# utilizzare l'indicizzatore dell'insieme come illustrato nell'esempio seguente, anziché la proprietà Item dell'insieme.

Esempi

In questo esempio, un metodo restituisce true se l'insieme CustomStrokes di un oggetto Ink contiene un insieme Strokes in corrispondenza dell'indice specificato. Se non esiste un insieme Strokes in corrispondenza dell'indice specificato, viene generata un'eccezione e il metodo restituisce 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;
}

Piattaforme

Windows Vista

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

CustomStrokes Classe

Membri CustomStrokes

Overload Item

Spazio dei nomi Microsoft.Ink

Item

Strokes