有没有办法用垂直滚动条创建一个上下文菜单(C#,WinForm) [英] Is there a way to create a context menu with vertical scroll bar (C#, WinForm)

查看:52
本文介绍了有没有办法用垂直滚动条创建一个上下文菜单(C#,WinForm)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用c#WinForm创建带垂直滚动条的上下文菜单。

我想动态添加菜单项。

解决方案

否。标准的上下文菜单不能有滚动条,坦率地说我赞同这些评论:这是一件好事,一个包含许多项目的菜单可能不太有用。



如果你想创建一个这样的用户界面,你必须自己处理右键并弹出另一个窗口,其中包含行为等上下文菜单(捕获鼠标,如果单击它关闭窗口,请按Esc或切换焦点远离应用程序。)


Is there a way to create a context menu with vertical scroll bar using c# WinForm.
I want to add menu items dynamically.

解决方案

No. A standard context menu can't have a scroll bar, and frankly I agree with the comments: this is a good thing, a menu with that many items is not likely to be useful.

If you want to create a UI like that you'll have to handle the right click yourself and pop up another window which has context menu like behaviour (capture the mouse, close the window if you click off it, press Esc or switch focus away from the application).


这篇关于有没有办法用垂直滚动条创建一个上下文菜单(C#,WinForm)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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