IToolboxUser.GetToolSupported(ToolboxItem) Método

Definición

Obtiene un valor que indica si la herramienta especificada es compatible con el diseñador actual.Gets a value indicating whether the specified tool is supported by the current designer.

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

Parámetros

tool
ToolboxItem

ToolboxItem para el que se va a realizar una comprobación de compatibilidad con el cuadro de herramientas.The ToolboxItem to be tested for toolbox support.

Devoluciones

true si la herramienta es compatible con el cuadro de herramientas y puede habilitarse; false si el diseñador de documentos no sabe cómo utilizar la herramienta.true if the tool is supported by the toolbox and can be enabled; false if the document designer does not know how to use the tool.

Ejemplos

En el ejemplo de código siguiente se muestra una GetToolSupported implementación del método.The following code example demonstrates an implementation of the GetToolSupported method.

// 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

Comentarios

Si la herramienta especificada es compatible con el diseñador que implementa IToolboxUser la interfaz, la herramienta se habilitará en el cuadro de herramientas cuando este diseñador tenga el foco.If the specified tool is supported by the designer implementing the IToolboxUser interface, then the tool will be enabled in the toolbox when this designer has focus. De lo contrario, se deshabilitará.Otherwise, it will be disabled. Una vez que una herramienta está marcada como habilitada o deshabilitada, es posible que no se compruebe de nuevo la compatibilidad con el mismo diseñador.Once a tool is marked as enabled or disabled, it may not be tested for support with the same designer again.

Se aplica a

Consulte también: