Partager via


ToolBoxTab3.ListView, propriété

Obtient ou définit une valeur indiquant si les éléments d'un onglet Boîte à outils spécifique s'affichent dans la vue Liste ou Icônes.

Espace de noms :  EnvDTE90
Assembly :  EnvDTE90 (dans EnvDTE90.dll)

Syntaxe

'Déclaration
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)

Valeur de propriété

Type : Boolean
true si l'onglet Boîte à outils est dans la vue Liste ; sinon, false.

Notes

La propriété ListView s'applique individuellement aux onglets de l'objet ToolBox. Autrement dit, un onglet peut s'afficher dans la vue Liste et un autre onglet dans la vue Icônes.

Les vues Liste et Icônes s'apparentent à celles de l'Explorateur Windows. En mode Liste, le contenu de la Boîte à outils est présenté sous forme d'une liste de descriptions, chacune identifiée par une icône à sa gauche. Dans la vue Icônes, à chaque élément correspond une icône unique. Vous pouvez obtenir une description par info-bulle de l'icône en plaçant votre souris au-dessus de l'icône.

Exemples

Cet exemple bascule la propriété ListView d'un onglet Boîte à outils. Pour plus d'informations sur l'exécution de cet exemple comme complément, consultez Comment : compiler et exécuter les exemples de code du modèle objet 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)
    ToolBoxListViewExample(_applicationObject)
End Sub
Sub ToolBoxListViewExample(ByVal dte As DTE2)
    Dim tlBox As ToolBox
    Dim tbxTabs As ToolBoxTabs
    Dim tbxTab As ToolBoxTab3
    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 EnvDTE90;
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;
    ToolBoxTab3 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);
    }
}

Sécurité .NET Framework

Voir aussi

Référence

ToolBoxTab3 Interface

EnvDTE90, espace de noms