Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Custom Designers
 Designer Verbs

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Windows Forms Programming
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.

Visual Basic
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.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker