共用方式為


ToolBoxTab3.Expanded 屬性

取得或設定值,這個值表示 [工具箱] 索引標籤會顯示或是向上捲動。

命名空間:  EnvDTE90
組件:  EnvDTE90 (在 EnvDTE90.dll 中)

語法

'宣告
Property Expanded As Boolean
bool Expanded { get; set; }
property bool Expanded {
    bool get ();
    void set (bool value);
}
abstract Expanded : bool with get, set
function get Expanded () : boolean
function set Expanded (value : boolean)

屬性值

型別:System.Boolean
布林值,表示索引標籤是否為展開狀態。

範例

這個範例會將一個新項目加入至 [工具箱] 索引標籤並啟動該項目,然後再展開及收合其索引標籤。 如需如何像執行增益集一般,執行這個範例的詳細資訊,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例

Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    ActivateExample(_applicationObject)
End Sub
Sub ActivateExample(ByVal dte As DTE2)
    ' Add a new tab to the Toolbox.
    Dim box As ToolBox = dte.ToolWindows.ToolBox
    Dim tab As ToolBoxTab3 = CType(box.ToolBoxTabs.Add _
    ("Sample ToolBoxTab"),ToolBoxTab3)
    ' Add two ToolBoxItem objects to the new Toolbox tab.
    Dim item As ToolBoxItem = tab.ToolBoxItems.Add("Text Item", _
        "Hello, text item!")
    tab.ToolBoxItems.Add("HTML Item", "Hello, HTML item!", _
        vsToolBoxItemFormat.vsToolBoxItemFormatHTML)
    ' Select the "Text Item" ToolBox item.
    box.Parent.AutoHides = False
    box.Parent.Activate()
    tab.Activate()
    tab.Expanded = False
    MsgBox("Expanded = false")
    tab.Expanded = True
    MsgBox("Expanded = true")
End Sub
using EnvDTE;
using EnvDTE80;
using EnvDTE90;
using System.Windows.Forms;
public void OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    ActivateExample(_applicationObject);
}
public void ActivateExample(DTE2 dte)
{
    // Add a new tab to the Toolbox.
    ToolBox box = dte.ToolWindows.ToolBox;
    ToolBoxTab3 tab = (ToolBoxTab3)box.ToolBoxTabs.Add
      ("Sample ToolBoxTab");
    // Add two ToolBoxItem objects to the new Toolbox tab.
    ToolBoxItem item = 
        tab.ToolBoxItems.Add("Text Item", "Hello, text item!",
        vsToolBoxItemFormat.vsToolBoxItemFormatText);
    tab.ToolBoxItems.Add("HTML Item", "Hello, HTML item!", 
        vsToolBoxItemFormat.vsToolBoxItemFormatHTML);
    // Select the "Text Item" ToolBox item.
    box.Parent.AutoHides = false;
    box.Parent.Activate();
    tab.Activate();
    tab.Expanded = false;
    MessageBox.Show("Expanded = false");
    tab.Expanded = true;
    MessageBox.Show("Expanded = true");
}

.NET Framework 安全性

請參閱

參考

ToolBoxTab3 介面

EnvDTE90 命名空間