C# 控制多个显示器上的菜单位置

发布于 2024-10-03 15:04:02 字数 379 浏览 0 评论 0原文

我有两个显示器。当我访问靠近左显示器边缘的 C# 应用程序的 MenuStrip 时,我看到一些奇怪的行为。

案例 1:在此屏幕截图中,当窗口非常靠近左显示器边缘时,我打开了 SubMenu1。 SubMenu2 显示在我的右显示器的最左边缘。

Gap

情况 2:然后,我将应用程序向左移动几个像素,现在 SubMenu2 出现在 SubMenu1 的左侧。

No Gap

在我看来,案例 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.

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无名指的心愿 2024-10-10 15:04:02

如果没有编写自己的 MenuStrip 组件,则无法指定 MenuItem 应在哪一侧打开。

此外,除非这是软件的特定要求(我对此非常怀疑),否则我不会太担心。

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.

两仪 2024-10-10 15:04:02

您可以在程序中控制它,将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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文