IToolboxUser.GetToolSupported(ToolboxItem) Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Získá hodnotu určující, zda zadaný nástroj je podporován aktuálním návrhářem.
public:
bool GetToolSupported(System::Drawing::Design::ToolboxItem ^ tool);
public bool GetToolSupported(System.Drawing.Design.ToolboxItem tool);
abstract member GetToolSupported : System.Drawing.Design.ToolboxItem -> bool
Public Function GetToolSupported (tool As ToolboxItem) As Boolean
Parametry
- tool
- ToolboxItem
Testovaný ToolboxItem pro podporu panelu nástrojů.
Návraty
true je-li nástroj podporován panelem nástrojů a lze jej povolit; false pokud návrhář dokumentů neví, jak nástroj používat.
Příklady
Následující příklad kódu ukazuje implementaci GetToolSupported metody.
// This method can signal whether to enable or disable the specified
// ToolboxItem when the component associated with this designer is selected.
bool IToolboxUser::GetToolSupported( ToolboxItem^ tool )
{
// Search the blocked type names array for the type name of the tool
// for which support for is being tested. Return false to indicate the
// tool should be disabled when the associated component is selected.
for ( int i = 0; i < blockedTypeNames->Length; i++ )
if ( tool->TypeName == blockedTypeNames[ i ] )
return false;
// Return true to indicate support for the tool, if the type name of the
// tool is not located in the blockedTypeNames string array.
return true;
}
// This method can signal whether to enable or disable the specified
// ToolboxItem when the component associated with this designer is selected.
bool IToolboxUser.GetToolSupported(ToolboxItem tool)
{
// Search the blocked type names array for the type name of the tool
// for which support for is being tested. Return false to indicate the
// tool should be disabled when the associated component is selected.
for (int i = 0; i < blockedTypeNames.Length; i++)
{
if (tool.TypeName == blockedTypeNames[i])
{
return false;
}
}
// Return true to indicate support for the tool, if the type name of the
// tool is not located in the blockedTypeNames string array.
return true;
}
' This method can signal whether to enable or disable the specified
' ToolboxItem when the component associated with this designer is selected.
Function GetToolSupported(ByVal tool As ToolboxItem) As Boolean Implements IToolboxUser.GetToolSupported
' Search the blocked type names array for the type name of the tool
' for which support for is being tested. Return false to indicate the
' tool should be disabled when the associated component is selected.
Dim i As Integer
For i = 0 To blockedTypeNames.Length - 1
If tool.TypeName = blockedTypeNames(i) Then
Return False
End If
Next i ' Return true to indicate support for the tool, if the type name of the
' tool is not located in the blockedTypeNames string array.
Return True
End Function
Poznámky
Pokud je zadaný nástroj podporován návrhářem, který implementuje IToolboxUser rozhraní, bude nástroj povolen v sadě nástrojů, když se tento návrhář zaměřuje. Jinak se zakáže. Jakmile je nástroj označený jako povolený nebo zakázaný, nemusí být znovu testován pro podporu stejného návrháře.