Convert MenuStrip to MainMenu
-
Hello... I have a problem. I'm using an ActiveX Control and the ActiveX Control need a reference to MainMenu and MenuItem. In VS2005 you can only add MenuStrip and ToolStripMenuItem. Are there any possibilities to convert the MenuStrip to MainMenu and ToolStripMenuItem to MenuItem ? Thanks...
-
Hello... I have a problem. I'm using an ActiveX Control and the ActiveX Control need a reference to MainMenu and MenuItem. In VS2005 you can only add MenuStrip and ToolStripMenuItem. Are there any possibilities to convert the MenuStrip to MainMenu and ToolStripMenuItem to MenuItem ? Thanks...
You can solve this problem in several ways. For example, you can iherit ToolStripMenuItem class and implement explicit cast (see "explicit" keyword in language reference). Another way is creating generic menu item (e.g. MyMenuItem class) that can create instances of both MenuItem and ToolStripMenuItem hiding itself in its Tag property. And yet another way is to program a converter, that will recursively create MenuItemCollection from ToolStripItemCollection or vice versa, this can be implemented as explicit convesion as suggested in the first paragraph. Hope this helps.
-
Hello... I have a problem. I'm using an ActiveX Control and the ActiveX Control need a reference to MainMenu and MenuItem. In VS2005 you can only add MenuStrip and ToolStripMenuItem. Are there any possibilities to convert the MenuStrip to MainMenu and ToolStripMenuItem to MenuItem ? Thanks...
Hi, MainMenu and MenuItem classes continue to exist. You can add them programmatically (just use the same code VS2003 used to generate through Visual Designer for you). :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
Hello... I have a problem. I'm using an ActiveX Control and the ActiveX Control need a reference to MainMenu and MenuItem. In VS2005 you can only add MenuStrip and ToolStripMenuItem. Are there any possibilities to convert the MenuStrip to MainMenu and ToolStripMenuItem to MenuItem ? Thanks...
the better answer is right here[^] :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google