System.Collections.IEnumerator インターフェイスを実装するオブジェクトを返します。このオブジェクトを使用すると、CursorButtons コレクション内の CursorButton オブジェクトを反復処理できます。
名前空間 : 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
System.Collections.IEnumerator インターフェイスを実装し、CursorButtons コレクション内の CursorButton オブジェクトを反復処理できるオブジェクト。
解説
この関数は、特定のメッセージ ハンドラ内で呼び出されると再入力されるため、予期しない結果が発生する可能性があります。WM_ACTIVATE、WM_ACTIVATEAPP、WM_NCACTIVATE、WM_PAINT、wParam が SC_HOTKEY または SC_TASKLIST に設定されている場合のWM_SYSCOMMAND および WM_SYSKEYDOWN (Alt-Tab キーまたは Alt-Esc キーの組み合わせで処理される場合) のいずれかのメッセージを処理するときは、再入呼び出しを回避するように注意してください。これはシングル スレッド アパートメント モデル アプリケーションに関する問題です。
例
これらの例では、CursorButtons コレクションを反復処理し、Cursor オブジェクト、theCursor の各 CursorButton オブジェクトの名前を取得する 2 つの方法を示します。CursorButtons コレクションは、Cursor.Buttons プロパティによって返されます。
この例では、System.Collections.IEnumerator が CursorButtons コレクション用に取得され、コレクションの各項目を列挙するために使用されます。
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);
}
この例では、foreach ステートメントを使用します。このステートメントは、ステートメントをサポートするためにコンパイラが生成する内部コードで、GetEnumerator メソッドを呼び出します。
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