Designer Verbs
A designer can use the DesignerVerb class to add menu commands to the shortcut menu for the component it provides designer support for in design mode. Designer verbs associate a menu item with an event handler. Designer verbs are provided to the design-time environment by the Verbs property of the IDesigner interface.
The following code example demonstrates an override of the Verbs property of the IDesigner interface that adds a DesignerVerb to create a custom menu command.
public class SampleVerbsDesigner IDesigner {
public SampleVerbsDesigner()
{}
public override DesignerVerbCollection Verbs {
get
{
return new DesignerVerbCollection(
new DesignerVerb[] {
new DesignerVerb("Test Command", this.testEventHandler) });
}
}
}
For an example of a Windows Forms control designer that implements designer verbs, see the Windows Forms Designer Sample. A corresponding Web Forms sample is provided in Web Forms Templated Data-Bound Control Designer.
See Also
Custom Designers | Base Designer Classes | Enabling Property Filtering | Windows Forms Designer Sample | Web Forms Templated Data-Bound Control Designer