Condividi tramite


Costruttore ToolboxBrowsableAttribute

Inizializza una nuova istanza della classe ToolboxBrowsableAttribute.

Spazio dei nomi:  Microsoft.Windows.Design
Assembly:  Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)

Sintassi

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

Parametri

  • browsable
    Tipo: System.Boolean
    true per abilitare la visibilità per un controllo in un browser della casella degli strumenti; in caso contrario, false.

Esempi

Nell'esempio di codice seguente viene illustrato come utilizzare ToolboxBrowsableAttribute per abilitare la visibilità per un controllo personalizzato nel browser della casella degli strumenti di una finestra di progettazione.

' 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();
        }
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

ToolboxBrowsableAttribute Classe

Spazio dei nomi Microsoft.Windows.Design

AttributeTableBuilder

Altre risorse

Procedura dettagliata: creazione di uno strumento decorativo visuale in fase di progettazione