共用方式為


ToolBoxTab2.ListView 屬性

取得或設定值,指出特定 [工具箱] 索引標籤中的項目是否以 [清單] 檢視或 [圖示] 檢視的格式顯示。

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

語法

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

屬性值

型別:System.Boolean
如果 [工具箱] 索引標籤是以 [清單] 檢視顯示,則為 true,否則為 false。

備註

ListViewToolBox 中可依索引標籤套用。也就是說,當一個索引標籤以 [清單] 檢視,其他的則以 [圖示] 檢視。

[清單] 檢視與 [圖示] 檢視和 Windows 檔案總管中的類似。在 [清單] 檢視中,[工具箱] 的內容會以文字說明逐一列出,並在左邊附有一個圖示。在 [圖示] 檢視,每一個項目只以一個圖示代表。您可以將滑鼠捲動到圖示上方,即可取得該圖示工具提示的描述。

範例

這個範例會切換 [工具箱] 索引標籤的 ListView 屬性。如需如何像執行增益集一般,執行這個範例的詳細資訊,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例

Imports EnvDTE
Imports EnvDTE80
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)
    ToolBoxListViewExample(_applicationObject)
End Sub
Sub ToolBoxListViewExample(ByVal dte As DTE2)
    Dim tlBox As ToolBox
    Dim tbxTabs As ToolBoxTabs
    Dim tbxTab As ToolBoxTab2
    Dim tbxItem As ToolBoxItem
    ' Before runiing this example, open a Windows Form project,
    ' and select Toolbox from the View menu.
    Try
        ' Create an object reference to the IDE's ToolBox object and
        ' its tabs.
        tlBox = CType(_applicationObject.Windows.Item _
         (Constants.vsWindowKindToolbox).Object, ToolBox)
        tbxTabs = tlBox.ToolBoxTabs
        ' Select the first ToolBox tab.
        tbxTab = CType(tbxTabs.Item(3), ToolBoxTab2)
        MsgBox(tbxTab.Name)
        tbxTab.Activate()
        tbxItem = tbxTab.ToolBoxItems.Item(1)
        MsgBox("Toolbox item name: " & tbxItem.Name)
        MsgBox("Turning Toolbox to List view...")
        tbxTab.ListView = False
        MsgBox("Turning Toolbox to Icon view...")
        tbxTab.ListView = True
    Catch ex As System.Exception
        MsgBox("ERROR: " & ex.Message)
    End Try
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    ToolBoxListViewExample(_applicationObject);
}
public void ToolBoxListViewExample(DTE2 dte)
{
    ToolBox tlBox;
    ToolBoxTabs tbxTabs;
    ToolBoxTab2 tbxTab;
    ToolBoxItem tbxItem;
    // Before running this example, open a Windows Form project
    // and select Toolbox from the View menu.
    try
    {
        //Create an object reference to the IDE's ToolBox object and
        // its tabs.
        tlBox = (ToolBox)_applicationObject.Windows.Item
(Constants.vsWindowKindToolbox).Object;
        tbxTabs = tlBox.ToolBoxTabs;
        // Select the first Toolbox tab.
        tbxTab = (ToolBoxTab2)tbxTabs.Item(3);
        MessageBox.Show(tbxTab.Name);
        tbxItem = tbxTab.ToolBoxItems.Item(1);
        MessageBox.Show("Toolbox item name: " + tbxItem.Name);
        MessageBox.Show("Turning Toolbox to List view...");
        tbxTab.ListView = false;
        MessageBox.Show("Turning Toolbox to Icon view...");
        tbxTab.ListView = true;
    }
    catch (Exception ex)
    {
        MessageBox.Show("ERROR: " + ex.Message);
    }
}

.NET Framework 安全性

請參閱

參考

ToolBoxTab2 介面

ListView 多載

EnvDTE80 命名空間