Showing context menus with the DesignSurface class. RRS feed

  • Question

  • Hi,

    I'm trying to get some simple contaxt menus displayed in my custom forms designer in .NET 2.0.

    Inside my DesignSurface derived class, in the constructor, I'm adding a reference to the ServiceContainer for a MenuCommandService class.

    When the application runs I have a toolbox hooked up, I can drag simple Windows controls on to the design surface but when I right click on a Button control for example I don't see any context menus.

    I would have expected the standard controls (buttons, textboxes, tabcontrols etc) to show some menu verbs. Am I expecting too much?

    If I am, how should I get the context menu to appear when say, a button is selected? Do I have to respond to the SelectionChanged event from the ISelectionService and add verbs myself depending on the control that was selected?

    Thanks for your help

    Monday, July 25, 2005 10:59 AM