Share via


CustomStrokes.Item Property (String)

Gets the Strokes collection with the specified name within the CustomStrokes collection.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public ReadOnly Property Item ( _
    name As String _
) As Strokes
'Usage
Dim instance As CustomStrokes 
Dim name As String 
Dim value As Strokes 

value = instance.Item(name)
public Strokes this[
    string name
] { get; }
public:
property Strokes^ Item[String^ name] {
    Strokes^ get (String^ name);
}
JScript does not support indexed properties.

Parameters

Property Value

Type: Microsoft.Ink.Strokes
The specified Strokes collection within the CustomStrokes collection.

Remarks

A System.ArgumentException is raised if the name does not match an existing member of the CustomStrokes collection.

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 with the specified name. If a Strokes collection does not exist with the specified name, an exception is raised and the method returns false.

Private Function CustomStrokesCollectionExists(ByVal mName As String, ByVal mInk As Ink) As Boolean 
    Try 
        Dim S As Strokes = mInk.CustomStrokes(mName)
        ' In VB, you can also access the named collections by using the Item property: 
        ' Dim S As Strokes = mInk.CustomStrokes.Item(mName) 
        ' 
        ' if the previous statement did not raise an exception,  
        ' the named Strokes collection exists 
        Return True 

    Catch E As ArgumentException
        ' this exception is raised when the named 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(string mName, Ink mInk)
{
    try
    {
        Strokes S = mInk.CustomStrokes[mName];
        // In C#, the Item property is not available. The following won't compile: 
        // Strokes S = mInk.CustomStrokes.Item[mName]; 

        // if the previous statement did not throw an exception,  
        // the named Strokes collection exists 
        return true;
    }
    catch (ArgumentException)
    {
        // this exception is raised when the named 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

See Also

Reference

CustomStrokes Class

CustomStrokes Members

Item Overload

Microsoft.Ink Namespace

Item

Strokes