この記事は翻訳者によって翻訳されたものです。 記事の文章にポインターを重ねると、原文のテキストが表示されます。 |
訳文
原文
|
SelectionContainer インターフェイス
プロジェクト項目レベルより下の選択項目をモデル化するオブジェクトによって選択コンテキストを表します。
アセンブリ: EnvDTE (EnvDTE.dll 内)
SelectionContainer 型で公開されるメンバーは以下のとおりです。
| 名前 | 説明 | |
|---|---|---|
|
Count | コレクション内のオブジェクトの数を示す値を取得します。 |
|
DTE | トップレベルの機能拡張オブジェクトを取得します。 |
|
Parent | SelectionContainer オブジェクトの直接の親オブジェクトを取得します。 |
| 名前 | 説明 | |
|---|---|---|
|
GetEnumerator() | コレクションを反復処理する列挙子を返します。 (IEnumerable から継承されます。) |
|
GetEnumerator() | コレクション内の項目の列挙体を取得します。 |
|
Item | SelectionContainer コレクション内のオブジェクトを返します。 |
SelectionContainer オブジェクトは、汎用選択追跡オブジェクトです。 環境には、DTE.SelectedItems.SelectionContainer というグローバル選択オブジェクトが 1 つ存在します。
SelectedItems は、個々の ProjectItem オブジェクトを表すコレクションです。このコレクションから Project オブジェクトを取得できます。 項目はコンテキスト内の任意のオブジェクトの選択項目を提供できるため、SelectionContainer は、選択したオブジェクトの任意の型を表すことができます。
Sub SelectionContainerExample() Dim SelContain As SelectionContainer Dim ContainerItem As SelectedItem ' Set references to the selection container and its selected item. SelContain = DTE.SelectedItems.SelectionContainer ContainerItem = DTE.SelectedItems.Item(1) ' Print the name of the container of the selected item. MsgBox(ContainerItem.Name) End Sub