mchr
mchr

Reputation: 6251

C# Control menu position across multiple monitors

I have two monitors. I am seeing some strange behaviour when I access the MenuStrip of my C# application near the edge of my left monitor.

Case 1: In this screenshot I have opened SubMenu1 when the window is fairly close to the edge of my left monitor. SubMenu2 shows up on the leftmost edge of my right monitor.

Gap

Case 2: I then move my application a few pixels to the left and now SubMenu2 appears to the left of SubMenu1.

No Gap

In my opinion, Case 2 looks much nicer. Is there any way to force C# to always show the menu like in Case 2?

Upvotes: 3

Views: 428

Answers (2)

Hans Passant
Hans Passant

Reputation: 942109

You can control it in your program, set the SubMenu1's RightToLeft property to RightToLeft.Yes. That has some side effects, the text will now be right-aligned and the arrow will point the correct way. You'd probably want to set the property in the a DropDownOpening event handler for the "Menu" item.

Upvotes: 1

Nobody
Nobody

Reputation: 4841

Short of writing your own MenuStrip component, there is no way to specify which side the MenuItem should open on.

Besides, unless this is a specific requirement of the software (which I highly doubt), I wouldn't worry too much about it.

Upvotes: 2

Related Questions