この記事は翻訳者によって翻訳されたものです。 記事の文章にポインターを重ねると、原文のテキストが表示されます。
訳文
原文
このトピックはまだ評価されていません - このトピックを評価する

SelectedItem インターフェイス

Visual Studio 統合開発環境 (IDE: Integrated Development Environment) で選択されているプロジェクトまたはプロジェクト項目を表します。

名前空間:  EnvDTE
アセンブリ:  EnvDTE (EnvDTE.dll 内)
[GuidAttribute("049D2CDF-3731-4CB6-A233-BE97BCE922D3")]
public interface SelectedItem

SelectedItem 型で公開されるメンバーは以下のとおりです。

  名前 説明
パブリック プロパティ Collection このプロパティをサポートしている SelectedItem オブジェクトを含む SelectedItems コレクションを取得します。
パブリック プロパティ DTE トップレベルの機能拡張オブジェクトを取得します。
パブリック プロパティ Info インフラストラクチャ。 マイクロソフト内部でのみ使用。
パブリック プロパティ InfoCount インフラストラクチャ。 マイクロソフト内部でのみ使用。
パブリック プロパティ Name SelectedItem オブジェクトの名前を取得します。
パブリック プロパティ Project SelectedItem オブジェクトに関連付けられている Project オブジェクトを取得します。
パブリック プロパティ ProjectItem 指定したオブジェクトに関連付けられている ProjectItem オブジェクトを取得します。
このページのトップへ
Sub SelectionContainerSelectedItemExample()
   Dim SelItems As SelectedItems
   Dim SelItemObj As SelectedItem
   Dim SelContain As SelectionContainer
   Dim SelItem As SelectedItem
   Dim NameStr As String

   SelItems = DTE.SelectedItems
   ' List the number of items selected.
   If SelItems.MultiSelect = True Then
      MsgBox("You have " & SelItems.Count & " items selected in _
        Solution Explorer.")
   End If

   ' Set a reference to the first selected item.
   SelItemObj = SelItems.Item(1)
   ' List the names of the project or project items under the selected 
   ' item.
   For Each SelItem In SelItemObj.Collection
      NameStr = NameStr & SelItem.Name
      If TypeOf SelItem.Project Is Project Then
         NameStr = NameStr & " Project-" & SelItem.Project.Name & vbCrLf
      Else
         If TypeOf SelItem.ProjectItem Is ProjectItem Then
             NameStr = NameStr & SelItem.ProjectItem.FileNames(1) & vbCrLf
         End If
      End If
   Next
   MsgBox("You selected: " & NameStr)
End Sub
この情報は役に立ちましたか。
(残り 1500 文字)
コミュニティ コンテンツ 追加
注釈 FAQ