다음을 통해 공유


ToolBoxTab2.ListView Property

Definition

Gets or sets a value indicating whether items in a particular ToolBox tab display in List view or Icon view format.

public:
 property bool ListView { bool get(); void set(bool value); };
public:
 property bool ListView { bool get(); void set(bool value); };
[System.Runtime.InteropServices.DispId(8)]
public bool ListView { [System.Runtime.InteropServices.DispId(8)] get; [System.Runtime.InteropServices.DispId(8)] set; }
[<System.Runtime.InteropServices.DispId(8)>]
[<get: System.Runtime.InteropServices.DispId(8)>]
[<set: System.Runtime.InteropServices.DispId(8)>]
member this.ListView : bool with get, set
Public Property ListView As Boolean

Property Value

true if the ToolBox tab is in List view; otherwise, false.

Implements

Attributes

Examples

This example toggles the ListView property of a Toolbox tab.

Imports EnvDTE  
Imports EnvDTE80  
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 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);  
    }  
}  

Remarks

ListView applies on a tab-by-tab basis in the ToolBox. That is, one tab can have List view while another has Icon view.

The List and Icon views are similar to those in Windows Explorer. In List view, the contents of the Toolbox are listed as text descriptions, one after another, with an icon on the left side. In Icon view, each item is represented only by an icon. You can get a ToolTip description of the icon by rolling the mouse over it.

Applies to