IToolboxUser::GetToolSupported Method (ToolboxItem^)

 

Gets a value indicating whether the specified tool is supported by the current designer.

Namespace:   System.Drawing.Design
Assembly:  System.Drawing (in System.Drawing.dll)

bool GetToolSupported(
	ToolboxItem^ tool
)

Parameters

tool
Type: System.Drawing.Design::ToolboxItem^

The ToolboxItem to be tested for toolbox support.

Return Value

Type: System::Boolean

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.

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. Otherwise, it will be disabled. Once a tool is marked as enabled or disabled, it may not be tested for support with the same designer again.

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;
}


.NET Framework
Available since 1.1
Return to top
Show: