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


CursorButtons.GetEnumerator - метод

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

Returns an object that implements the System.Collections.IEnumerator interface and that can iterate through the CursorButton objects within the CursorButtons collection.

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

Синтаксис

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

returnValue = instance.GetEnumerator()
public CursorButtons..::.CursorButtonsEnumerator GetEnumerator()
public:
CursorButtons..::.CursorButtonsEnumerator^ GetEnumerator()
public CursorButtons..::.CursorButtonsEnumerator GetEnumerator()
public function GetEnumerator() : CursorButtons..::.CursorButtonsEnumerator

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

Тип: Microsoft.Ink.CursorButtons.CursorButtonsEnumerator
An object that implements the System.Collections.IEnumerator interface and that can iterate through the CursorButton objects within the CursorButtons collection.

Заметки

This function can be re-entered if called within certain message handlers, causing unexpected results. Take care to avoid a reentrant call when handling any of the following messages: WM_ACTIVATE, WM_ACTIVATEAPP, WM_NCACTIVATE, WM_PAINT; WM_SYSCOMMAND if wParam is set to SC_HOTKEY or SC_TASKLIST; and WM_SYSKEYDOWN (when processing Alt-Tab or Alt-Esc key combinations). This is an issue with single-threaded apartment model applications.

Примеры

These examples show two ways to iterate over the CursorButtons collection and get the name for each CursorButton object in the Cursor object, theCursor. The CursorButtons collection is returned by the Cursor.Buttons property.

In this example, the System.Collections.IEnumerator is obtained for the CursorButtons collection, and used to enumerate each item of the collection.

Dim names As ArrayList = New ArrayList()
Dim ienum As IEnumerator = cursor.Buttons.GetEnumerator()
ienum.Reset()
While ienum.MoveNext()
    Dim theButton As CursorButton = DirectCast(ienum.Current, CursorButton)
    names.Add(theButton.Name)
End While
ArrayList names = new ArrayList();
IEnumerator ienum = cursor.Buttons.GetEnumerator();
ienum.Reset();
while (ienum.MoveNext())
{
    CursorButton theButton = (CursorButton)ienum.Current;
    names.Add(theButton.Name);
}

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

Dim names As ArrayList = New ArrayList()
For Each theButton As CursorButton In cursor.Buttons
    names.Add(theButton.Name)
Next
ArrayList names = new ArrayList();
foreach (CursorButton theButton in cursor.Buttons)
{
    names.Add(theButton.Name);
}

Платформы

Windows Vista

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

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

.NET Framework

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

См. также

Ссылки

CursorButtons Класс

CursorButtons - члены

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

CursorButton

Cursor.Buttons

Cursor