Partager via


ToolboxBrowsableAttribute, constructeur

Initialise une nouvelle instance de la classe ToolboxBrowsableAttribute.

Espace de noms :  Microsoft.Windows.Design
Assembly :  Microsoft.Windows.Design.Interaction (dans Microsoft.Windows.Design.Interaction.dll)

Syntaxe

'Déclaration
Public Sub New ( _
    browsable As Boolean _
)
public ToolboxBrowsableAttribute(
    bool browsable
)
public:
ToolboxBrowsableAttribute(
    bool browsable
)
new : 
        browsable:bool -> ToolboxBrowsableAttribute
public function ToolboxBrowsableAttribute(
    browsable : boolean
)

Paramètres

  • browsable
    Type : System.Boolean
    true pour activer la visibilité d'un contrôle dans un navigateur de boîte à outils ; sinon,false.

Exemples

L'exemple de code suivant indique comment utiliser ToolboxBrowsableAttribute pour activer la visibilité d'un contrôle personnalisé dans le navigateur de boîte à outils d'un concepteur.

' Container for any general design-time metadata to initialize.
' Designers look for a type in the design-time assembly that 
' implements IProvideAttributeTable. If found, designers instantiate
' this class and access its AttributeTable property automatically.
Friend Class Metadata
    Implements IProvideAttributeTable

    ' Accessed by the designer to register any design-time metadata.
    Public ReadOnly Property AttributeTable() As AttributeTable _
        Implements IProvideAttributeTable.AttributeTable
        Get
            Dim builder As New AttributeTableBuilder()

            builder.AddCustomAttributes( _
                GetType(ButtonWithDesignTime), _
                New ToolboxBrowsableAttribute(True))

            Return builder.CreateTable()
        End Get
    End Property

End Class
// Container for any general design-time metadata to initialize.
// Designers look for a type in the design-time assembly that 
// implements IProvideAttributeTable. If found, designers instantiate 
// this class and access its AttributeTable property automatically.
internal class Metadata : IProvideAttributeTable
{
    // Accessed by the designer to register any design-time metadata.
    public AttributeTable AttributeTable
    {
        get 
        {
            AttributeTableBuilder builder = new AttributeTableBuilder();

            builder.AddCustomAttributes(
                typeof(ButtonWithDesignTime),
                new ToolboxBrowsableAttribute(true));

            return builder.CreateTable();
        }
    }
}

Sécurité .NET Framework

Voir aussi

Référence

ToolboxBrowsableAttribute Classe

Microsoft.Windows.Design, espace de noms

AttributeTableBuilder

Autres ressources

Procédure pas à pas : création d'un ornement au moment du design