ContextMenuStrip - select direction of expanded menu + stay visible after click
Is it possible to select the direction of the submenu in a contextmenu?
I have a menu with 5-6 substeps and they go left-right-left-right-left-right so you get totaly confused when you are at the end. I want all expansions to always go left, is that possible? I use this code to add the submenus.
| ToolStripMenuItem title =newToolStripMenuItem("title")); ToolStripMenuItem description=newToolStripMenuItem("desc")); title.DropDownItems.Add(description); maincontextmenu.DropDownItems.Add(title); |
|
I also wonder if it's possible to let the contextmenu remain visible after you've clicked a button in it? I use data from a webservice in the menu and i want to add a refreshbutton at the top of the menu. Just adding a button and use the click-event doesn't work couse that will collapse the entire contextmenu.
[1496 byte] By [
Chimme] at [2007-12-24]
Thanks, it worked but it looks strange with the text aligned to the right, found another property that worked better: DropDownDirection. It's a bit strange that the arrow doesn't point to the left but it's better than having the icon and text aligned to the right. 
I have another question regarding toolstripitems:
If you have an item with text on two(or more) rows, all items will get double height, even those who only have text on one row. Is it possible to have different height on the items in a menu? Same thing for images, if you have a big image on a toolstripitem (and don't use SizeToFit) all items will get that height.
Edit: Setting the height manually works but the text will still be aligned to fit to the center of the original(too high) height. And the TextAlign-property doesn't seem to do anything at all so changing it won't help eighter 
Look at this image: http://erik.er.funpic.org/temp/strangetoolstrip.png
If you are still looking for a way to keep the ContextMenuStrip from closing after you click a Item. All you have to do is use the ContextMenuStrip.Closing Event. The EventArgs have a Property for CloseReason, one of the reasons is ItemClicked. Just do a simple if statement and e.Cancel = true. That should keep it open with no side affects.