Udostępnij za pośrednictwem


Designer Verbs

The DesignerAction feature replaces and adds functionality to the designer verbs feature; however, the designer verbs feature is retained for both backward compatibility and future use, if you choose. For more information, see Designer Commands and the DesignerAction Object Model for Windows Forms.

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.

See Also

Concepts

Base Designer Classes

Metadata Filtering

How to: Implement a Designer for a Control

Designer Commands and the DesignerAction Object Model for Windows Forms

Other Resources

Custom Designers