在WinForms中设置下拉方向 [英] Set dropdown direction in WinForms

查看:90
本文介绍了在WinForms中设置下拉方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,winforms下拉菜单始终从下拉按钮/菜单项向右扩展.但是,我在窗口的最右侧有一个工具箱按钮(类似于chrome的options按钮);单击后,默认菜单将始终扩展到窗口之外.

By default, a winforms dropdown always extends to the right from the dropdown button / menu item. However, I have a toolbox button (similiar to chrome's options button) which is on the far-right side of the window; when clicked, the default menu would always extend outside of the window.

是否有任何内置方法可以使菜单从下拉按钮左移,还是必须手动设置菜单的位置并手动显示/隐藏?

Are there any built-in ways to make the menu drop left from the dropdown button, or do I have to set the menu's position by hand, and manually show/hide?

在两种情况下,这种行为不尽如人意:

there are 2 situations, where such behaviour is less than optimal:

  • 如果它不是全屏显示或不靠近右端,它将在应用程序的窗口中闲逛;和

  • if it's not full-screen, or close to the right end, it will hang out from the app's window; and

在多显示器环境中,它会落在下一个显示器上

In a multi-monitor enviornment, it drops down on the next monitor

推荐答案

看看这个:

http://msdn.microsoft.com/zh-CN/library/system.windows.forms.toolstripdropdowndirection.aspx

假设您使用的是.NET和ToolStripMenuItems,则可以将DropdownDirection属性设置为这些枚举之一.

Assuming you're using .NET and ToolStripMenuItems, there is a DropdownDirection property that you can set to one of these enums.

这篇关于在WinForms中设置下拉方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆