Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Convert MenuStrip to MainMenu

Convert MenuStrip to MainMenu

Scheduled Pinned Locked Moved C#
comhelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

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

    L L 3 Replies Last reply
    0
    • L Lost User

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

      L Offline
      L Offline
      Libor Tinka
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • L Lost User

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

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        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


        1 Reply Last reply
        0
        • L Lost User

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

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          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


          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups