StrataFrame Forum

Drop down menu when click button

http://forum.strataframe.net/Topic8138.aspx

By Chan - 4/16/2007

 Hi,
How to show drop down menu when command button clicked with LEFT mouse button?
I tired to use contextmenustrip but it only shown if RIGHT mouse button clicked. I also tried to show contextmenustrip programmatically in clicked event. However, it doesn't shown under button.

Any ideas?

Thank you
By Trent L. Taylor - 4/16/2007

You can control the position of the ContextMenuSTrip when showing programmatically.  There is an overload that allows you to specify the X and Y position.
By Chan - 4/16/2007

Hi,

I tried to pass button.location to contextmenustrip.show() but it doesnt show menu at the right place. Any ideas?

Thank you

By StrataFrame Team - 4/17/2007

The Show(int, int) is in screen coordinates... you'll have to convert the button.Location to screen coordinates by doing this:

menu.Show(button.PointToScreen(button.Location));

That should get it to show in the right spot.