ToolBoxItems.SelectedItem プロパティ

更新 : 2007 年 11 月

[ツールボックス] のタブで現在選択されているアイテムがある場合は、そのアイテムを取得します。

名前空間 :  EnvDTE
アセンブリ :  EnvDTE (EnvDTE.dll 内)

構文

'宣言
ReadOnly Property SelectedItem As ToolBoxItem
'使用
Dim instance As ToolBoxItems
Dim value As ToolBoxItem

value = instance.SelectedItem
ToolBoxItem SelectedItem { get; }
property ToolBoxItem^ SelectedItem {
    ToolBoxItem^ get ();
}
function get SelectedItem () : ToolBoxItem

プロパティ値

型 : EnvDTE.ToolBoxItem

ToolBoxItem オブジェクト。

解説

[ツールボックス] のタブにアイテムが存在しない場合、またはアイテムが選択されていない場合、SelectedItem は Nothing を返します。

Sub SelectedItemExample(ByVal dte As DTE2)

    ' Before running this example, select an item in the 
    ' ToolBox window.

    Dim tab As ToolBoxTab = dte.ToolWindows.ToolBox.ActiveTab
    Dim item As ToolBoxItem = tab.ToolBoxItems.SelectedItem

    If IsNothing(tab) = False Then
        MsgBox("The selected toolbox item is " & item.Name)
    Else
        MsgBox("No toolbox item is selected")
    End If

End Sub
public void SelectedItemExample(DTE2 dte)
{
    // Before running this example, select an item in the 
    // ToolBox window.

    ToolBoxTab tab = dte.ToolWindows.ToolBox.ActiveTab;
    ToolBoxItem item = tab.ToolBoxItems.SelectedItem;

    if (tab != null)
        MessageBox.Show("The selected toolbox item is " + item.Name);
    else
        MessageBox.Show("No toolbox item is selected");
}

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

ToolBoxItems インターフェイス

ToolBoxItems メンバ

EnvDTE 名前空間

その他の技術情報

方法 : ツールボックスを制御する