ToolboxBrowsableAttribute 建構函式
初始化 ToolboxBrowsableAttribute 類別的新執行個體。
命名空間: Microsoft.Windows.Design
組件: Microsoft.Windows.Design.Interaction (在 Microsoft.Windows.Design.Interaction.dll 中)
語法
'宣告
Public Sub New ( _
browsable As Boolean _
)
public ToolboxBrowsableAttribute(
bool browsable
)
public:
ToolboxBrowsableAttribute(
bool browsable
)
new :
browsable:bool -> ToolboxBrowsableAttribute
public function ToolboxBrowsableAttribute(
browsable : boolean
)
參數
- browsable
型別:System.Boolean
true 表示控制項可以在工具箱瀏覽器中顯示,否則為 false。
範例
下列程式碼範例說明如何使用 ToolboxBrowsableAttribute 讓自訂控制項在設計工具的工具箱瀏覽器中顯示。
' 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();
}
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。