Поделиться через


CustomStrokes.GetEnumerator - метод

Обновлен: Ноябрь 2007

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

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
Public Function GetEnumerator As CustomStrokes..::.CustomStrokesEnumerator
'Применение
Dim instance As CustomStrokes
Dim returnValue As CustomStrokes..::.CustomStrokesEnumerator

returnValue = instance.GetEnumerator()
public CustomStrokes..::.CustomStrokesEnumerator GetEnumerator()
public:
CustomStrokes..::.CustomStrokesEnumerator^ GetEnumerator()
public CustomStrokes..::.CustomStrokesEnumerator GetEnumerator()
public function GetEnumerator() : CustomStrokes..::.CustomStrokesEnumerator

Возвращаемое значение

Тип: Microsoft.Ink.CustomStrokes.CustomStrokesEnumerator
Returns an object that implements the System.Collections.IEnumerator interface and that can iterate through the Strokes collections within the CustomStrokes collection.

Примеры

These examples show two ways to enumerate the CustomStrokes collection in order to retrieve each Strokes object contained in the collection.

This example obtains the IEnumerator for the CustomStrokes collection, and uses it to traverse the collection. Each Strokes object is then scaled by a factor of 2.

Private Sub EnumerateCustomStrokesWithEnumerator(ByVal mInk As Ink)
    Dim mCustomStrokesEnumerator As IEnumerator = mInk.CustomStrokes.GetEnumerator()
    mCustomStrokesEnumerator.Reset()
    While (mCustomStrokesEnumerator.MoveNext())
        Dim S As Strokes = DirectCast(mCustomStrokesEnumerator.Current, Strokes)
        S.Scale(2, 2)
    End While
End Sub
private void EnumerateCustomStrokesWithEnumerator(Ink mInk)
{
    IEnumerator mCustomStrokesEnumerator = mInk.CustomStrokes.GetEnumerator();
    mCustomStrokesEnumerator.Reset();
    while (mCustomStrokesEnumerator.MoveNext())
    {
        Strokes S = (Strokes)mCustomStrokesEnumerator.Current;
        S.Scale(2, 2);
    }
}

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

Private Sub EnumerateCustomStrokesWithForEach(ByVal mInk As Ink)
    For Each S As Strokes In mInk.CustomStrokes
        S.Scale(2, 2)
    Next
End Sub
private void EnumerateCustomStrokesWithForEach(Ink mInk)
{
    foreach (Strokes S in mInk.CustomStrokes)
    {
        S.Scale(2, 2);
    }

}

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

CustomStrokes Класс

CustomStrokes - члены

Microsoft.Ink - пространство имен

Strokes

Ink.CustomStrokes

Strokes.Scale