C# 控制多个显示器上的菜单位置
我有两个显示器。当我访问靠近左显示器边缘的 C# 应用程序的 MenuStrip 时,我看到一些奇怪的行为。
案例 1:在此屏幕截图中,当窗口非常靠近左显示器边缘时,我打开了 SubMenu1。 SubMenu2 显示在我的右显示器的最左边缘。
情况 2:然后,我将应用程序向左移动几个像素,现在 SubMenu2 出现在 SubMenu1 的左侧。
在我看来,案例 2 看起来更好。有没有办法强制 C# 始终显示菜单,如案例 2 所示?
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.
Case 2: I then move my application a few pixels to the left and now SubMenu2 appears to the left of SubMenu1.
In my opinion, Case 2 looks much nicer. Is there any way to force C# to always show the menu like in Case 2?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有编写自己的
MenuStrip
组件,则无法指定MenuItem
应在哪一侧打开。此外,除非这是软件的特定要求(我对此非常怀疑),否则我不会太担心。
Short of writing your own
MenuStrip
component, there is no way to specify which side theMenuItem
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.
您可以在程序中控制它,将SubMenu1的RightToLeft属性设置为RightToLeft.Yes。这有一些副作用,文本现在将右对齐,箭头将指向正确的方向。您可能希望在“菜单”项的 DropDownOpening 事件处理程序中设置该属性。
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.