Partager via


CustomStrokes.GetEnumerator Method

CustomStrokes.GetEnumerator Method

Returns an object that implements the System.Collections.IEnumerator Leave Site interface and that can iterate through the Stroke collections within the CustomStrokes collection.

Definition

Visual Basic .NET Public Function GetEnumerator() As CustomStrokesEnumerator
C# public CustomStrokesEnumerator GetEnumerator();
Managed C++ public: CustomStrokesEnumerator* GetEnumerator();

Return Value

Microsoft.Ink.CustomStrokes.CustomStrokesEnumerator. Returns an object that implements the IEnumerator Leave Site interface and that can iterate through the Strokes collections within the CustomStrokes collection.

Examples

[C#]

These C# examples show two ways to iterate over the CustomStrokes collection and scale each Strokes collection in the CustomStrokes collection, theCustomStrokes, by a factor of two. The CustomStrokes collection is returned by the Ink.CustomStrokes property.

This C# example gets the IEnumerator Leave Site for the CustomStrokes collection.

ArrayList names = new ArrayList();
// Version using GetEnumerator()
IEnumerator ienum = theInk.CustomStrokes.GetEnumerator();
while (ienum.MoveNext())
{
    Strokes theStrokes = (Strokes) ienum.Current;
    theStrokes.Scale(2, 2);
}

This C# example uses the foreach statement, which calls the GetEnumerator method in internal code that the compiler generates to support the statement.

ArrayList names = new ArrayList();
// Version using foreach
foreach (Stroke theStrokes in theInk.Strokes)
{
    theStrokes.Scale(2, 2);
}

[VB.NET]

These Microsoft® Visual Basic® .NET examples show two ways to iterate over the CustomStrokes collection and scale each Strokes collection in the CustomStrokes collection, theCustomStrokes, by a factor of two. The CustomStrokes collection is returned by the Ink.CustomStrokes property.

This Visual Basic .NET example gets the IEnumerator Leave Site for the CustomStrokes collection.

'Version using GetEnumerator()
Dim theStrokes As Strokes
Dim ienum As IEnumerator = theInk.CustomStrokes.GetEnumerator()
While (ienum.MoveNext())
    theStrokes = ienum.Current
    theStrokes.Scale(2, 2)
End While

This Visual Basic .NET example uses the For Each statement, which calls the GetEnumerator method in internal code that the compiler generates to support the statement.

'Version using For Each
Dim names As New ArrayList()
Dim theButton as CursorButton

For Each theStrokes In theInk.CustomStrokes
    theStrokes.Scale(2, 2)

See Also