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. open MenuItem of MainMenu by code

open MenuItem of MainMenu by code

Scheduled Pinned Locked Moved C#
question
10 Posts 4 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.
  • N Offline
    N Offline
    nadapublicidad
    wrote on last edited by
    #1

    how can i open(visualize) a System.Windows.Forms.MenuItem of System.Windows.Forms.MainMenu by code? :confused: jaye

    Q L 2 Replies Last reply
    0
    • N nadapublicidad

      how can i open(visualize) a System.Windows.Forms.MenuItem of System.Windows.Forms.MainMenu by code? :confused: jaye

      Q Offline
      Q Offline
      quiteSmart
      wrote on last edited by
      #2

      if this menuItem has other menuItems under it you use the following statment menuItem1.ShowDropDown(); if it doesn't have you show use the above statment on its parent menu item

      N 1 Reply Last reply
      0
      • Q quiteSmart

        if this menuItem has other menuItems under it you use the following statment menuItem1.ShowDropDown(); if it doesn't have you show use the above statment on its parent menu item

        N Offline
        N Offline
        nadapublicidad
        wrote on last edited by
        #3

        sorry but this metod (ShowDropDown) isn´t appear in my Visual Studio 2003 C#.

        jaye

        S 1 Reply Last reply
        0
        • N nadapublicidad

          how can i open(visualize) a System.Windows.Forms.MenuItem of System.Windows.Forms.MainMenu by code? :confused: jaye

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

          I suggest you try MenuItem.PerformClick() :)

          Luc Pattyn

          N 1 Reply Last reply
          0
          • L Luc Pattyn

            I suggest you try MenuItem.PerformClick() :)

            Luc Pattyn

            N Offline
            N Offline
            nadapublicidad
            wrote on last edited by
            #5

            with menuItem1.PerformClick(); you send a event of Click. but the menu isn´t open so i can´t visualize it. :((

            jaye

            Q 1 Reply Last reply
            0
            • N nadapublicidad

              with menuItem1.PerformClick(); you send a event of Click. but the menu isn´t open so i can´t visualize it. :((

              jaye

              Q Offline
              Q Offline
              quiteSmart
              wrote on last edited by
              #6

              jaimeaye wrote:

              with menuItem1.PerformClick(); you send a event of Click.

              that's right, but if you do this on the parent menuItem it will do what you wish cz the click event of the parent menu item is to open its drop down items. for example if your have a File menu item and under it New. if you like to view nuew you write: fileMenuItem.PerformClick();

              S 1 Reply Last reply
              0
              • N nadapublicidad

                sorry but this metod (ShowDropDown) isn´t appear in my Visual Studio 2003 C#.

                jaye

                S Offline
                S Offline
                Stefan Troschuetz
                wrote on last edited by
                #7

                jaimeaye wrote:

                sorry but this metod (ShowDropDown) isn´t appear in my Visual Studio 2003 C#.

                It can't. The ShowDropDown method is member of the ToolStripMenuItem class that is new in .NET Framework 2.0. I think the classes in Framework 1.1 provide no support for what you're trying to achieve, so you're somehow at a loss.


                "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

                www.troschuetz.de

                1 Reply Last reply
                0
                • Q quiteSmart

                  jaimeaye wrote:

                  with menuItem1.PerformClick(); you send a event of Click.

                  that's right, but if you do this on the parent menuItem it will do what you wish cz the click event of the parent menu item is to open its drop down items. for example if your have a File menu item and under it New. if you like to view nuew you write: fileMenuItem.PerformClick();

                  S Offline
                  S Offline
                  Stefan Troschuetz
                  wrote on last edited by
                  #8

                  Did you tested this? I've tried and it doesn't work. Also the PerformSelect method doesn't show the menu.


                  "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

                  www.troschuetz.de

                  Q 1 Reply Last reply
                  0
                  • S Stefan Troschuetz

                    Did you tested this? I've tried and it doesn't work. Also the PerformSelect method doesn't show the menu.


                    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

                    www.troschuetz.de

                    Q Offline
                    Q Offline
                    quiteSmart
                    wrote on last edited by
                    #9

                    Stefan Troschütz wrote:

                    Did you tested this?

                    Sorry i didn't do that, but i assumed it will work. anyway i will try to figure out another solution

                    S 1 Reply Last reply
                    0
                    • Q quiteSmart

                      Stefan Troschütz wrote:

                      Did you tested this?

                      Sorry i didn't do that, but i assumed it will work. anyway i will try to figure out another solution

                      S Offline
                      S Offline
                      Stefan Troschuetz
                      wrote on last edited by
                      #10

                      quiteSmart wrote:

                      Sorry i didn't do that, but i assumed it will work.

                      No need to apologize. I was just curious if it may work on other computers.

                      quiteSmart wrote:

                      anyway i will try to figure out another solution

                      Maybe one could disassemble the ToolStripMenuItem and see what they are doing inside the ShowDropDown method. Or use Windows API to really simulate a mouse click on the menu item.


                      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

                      www.troschuetz.de

                      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