How to open menu programmatically

G

Gregory K

I am using Windows Forms, C#, VS2005.
I am developing an assistant that will guide a user through the application.
At some point I need to open specific menus just like the user would by
moving a mouse over it (for example, open File submenu in the Main menu).
How can I do it from the code?
Gregory
 
M

miher

"Gregory K" <[email protected]> az alábbiakat írta a
következő üzenetben
I am using Windows Forms, C#, VS2005.
I am developing an assistant that will guide a user through the
application.
At some point I need to open specific menus just like the user would by
moving a mouse over it (for example, open File submenu in the Main menu).
How can I do it from the code?
Gregory

Hi,

Try using the ShowDropDown method.
(
http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripdropdownitem.showdropdown.aspx )

Hope You find this useful.
-Zsolt
 
G

Gregory K

I have another question. How can I programmatically show the context menu of
a TreeNode? I tried node.ContextMenuStrip.Show() but it shows the menu in a
wrong location. I can determine absolute location of the node at run time and
use it as a parameter to Show() but it's not trivial. I hope there is a
better way.
Gregory
 
J

Jeff Johnson

I have another question. How can I programmatically show the context menu
of
a TreeNode? I tried node.ContextMenuStrip.Show() but it shows the menu in
a
wrong location. I can determine absolute location of the node at run time
and
use it as a parameter to Show() but it's not trivial. I hope there is a
better way.

Nope, that's the only way. Why do you say it's not trivial, though? Just use
the Show() overload that takes a Control and a Point, and use the parent
tree view as the Control and extract a Point from the node's Bounds
property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top