A designer class must implement the IDesigner interface, as shown in the following code example.
Public Interface IDesigner
Sub Dispose()
Sub Initialize(component As IComponent)
' Other methods.
...
ReadOnly Property Component() As IComponent
' Other properties.
...
End Interface
public interface IDesigner {
void Dispose();
void Initialize(IComponent component);
// Other methods.
...
IComponent Component {
get;
}
// Other properties.
...
}
The Initialize method of an IDesigner is called after the component for the designer has been sited and initialized, and the designer has been created. You can override the Initialize method to perform actions that should occur at component or designer initialization time. You cannot replace the constructor initialization of the component, but you can augment it or reset the properties that it initializes. The Component property of an IDesigner is set through this initialization method. You should always call base.Initialize(component) from your Initialize method if you override this method. You can access the component of an IDesigner from its Component property.
The Component property provides access to the component that the designer is associated with. This property is set when the designer object is first created and its Initialize method is called. The component has a site associated with it, and the designer can use this site to obtain services from the designer's host.
The DoDefaultAction method is called when a component or control is double-clicked.
The Verbs property can be overridden to return a DesignerVerbCollection that contains the objects necessary to extend the menu items of a shortcut menu for a component.
The Dispose method is invoked when the designer object needs to be destroyed. It is called whenever a component is removed from the design container.