open MenuItem of MainMenu by code
-
how can i open(visualize) a System.Windows.Forms.MenuItem of System.Windows.Forms.MainMenu by code? :confused: jaye
-
how can i open(visualize) a System.Windows.Forms.MenuItem of System.Windows.Forms.MainMenu by code? :confused: jaye
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 -
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 itemsorry but this metod (ShowDropDown) isn´t appear in my Visual Studio 2003 C#.
jaye
-
how can i open(visualize) a System.Windows.Forms.MenuItem of System.Windows.Forms.MainMenu by code? :confused: jaye
I suggest you try MenuItem.PerformClick() :)
Luc Pattyn
-
I suggest you try MenuItem.PerformClick() :)
Luc Pattyn
with menuItem1.PerformClick(); you send a event of Click. but the menu isn´t open so i can´t visualize it. :((
jaye
-
with menuItem1.PerformClick(); you send a event of Click. but the menu isn´t open so i can´t visualize it. :((
jaye
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();
-
sorry but this metod (ShowDropDown) isn´t appear in my Visual Studio 2003 C#.
jaye
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 theToolStripMenuItem
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
-
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();
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
-
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
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
-
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
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