locked
AddIn: Need some advice to find a start RRS feed

  • Question

  • Hello !

    Can someone please advice me about what I'll need to do to achive the following:

    I have...

    - A MyBase class which derives from System.ComponentModel.Component and a number of classes A, B, C... that derive from MyBase. A, B, C are available from the ToolBox.

    - A component class file (the kind gray pane where the user von add other components from the tool box to it) that contains instances of A, B, C. Here the user can use the Properties window to configure these objects by setting properties.

    I want...

    - An AddId (or such) that adds a Command to the context menu that opens up when the user right-clicks one the objects A, B, C in the component file editor. When one of my component objects (derived from MyBase) is selected and the menu opens, I want to have this menu command and when it is selected, I need a reference to the selected object instance. Then I want to create some kind or report output and save it somewhere (which should be easy).

    Can someone PLEASE give me some hints where I can make a start to achive this? (I found samples to add commands to the Tools menu but that's not really what I want.)

    THANKS!!

    Karlo

    Friday, July 1, 2011 3:19 PM

Answers

  • Hello,

    While you could create an add-in that provides a menu entry in the context menu of a component that is only visible when the component meets some criteria, it wouldn't be the right approach because the component model already provides a way to add designer commands:

    Designer Commands and the DesignerAction Object Model for Windows Forms
    http://msdn.microsoft.com/en-us/library/ms171567%28VS.80%29.aspx

     


    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/
    • Proposed as answer by Carlos J. Quintero Saturday, July 2, 2011 8:49 PM
    • Marked as answer by KarloX2 Monday, July 4, 2011 7:57 PM
    Saturday, July 2, 2011 8:49 PM

All replies

  • Hello,

    While you could create an add-in that provides a menu entry in the context menu of a component that is only visible when the component meets some criteria, it wouldn't be the right approach because the component model already provides a way to add designer commands:

    Designer Commands and the DesignerAction Object Model for Windows Forms
    http://msdn.microsoft.com/en-us/library/ms171567%28VS.80%29.aspx

     


    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/
    • Proposed as answer by Carlos J. Quintero Saturday, July 2, 2011 8:49 PM
    • Marked as answer by KarloX2 Monday, July 4, 2011 7:57 PM
    Saturday, July 2, 2011 8:49 PM
  • Hello Carlos,

    this seems to be a very good hint. Thank's very much!

    I played with the Designer Commands + Actions. While it works fine for a component on a WinForms window, I can't get smart tags show up in a Component class document (when I drag my or any other component from the toopbox on such a document). This is - however - what I need. It does not need to be exactly a smart tag. A command that shows up in a menu would also work.

    Can you give any advice how to do this?

    Thanks

    Karlo


    Monday, July 4, 2011 4:51 PM
  • Hi Carlos,

     

    I now realized that DesignerVerbs are in fact available in the commands section of the property editor window. This seems to work fine.

    Thanks for your help.

    Karlo

    Monday, July 4, 2011 7:57 PM