显示从ToolStripDropDown的ContextMenuStrip没有解雇ToolStripDropDown [英] Show ContextMenuStrip from ToolStripDropDown without dismissing ToolStripDropDown

查看:350
本文介绍了显示从ToolStripDropDown的ContextMenuStrip没有解雇ToolStripDropDown的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个的ToolStrip 。在我的的ToolStrip 我有一个 ToolStripDropDownButton 。我的 ToolStripDropDownButton 有一个类型的下拉 ToolStripDropDown 包含 ToolStripControlHost 其中包含一个标签。我已经分配了一个的ContextMenuStrip 我的标签。在标签上。当我告诉下拉列表,然后右键单击,在的ContextMenuStrip 显示正确,但原来的下拉被驳回。

I have a ToolStrip. In my ToolStrip I have a ToolStripDropDownButton. My ToolStripDropDownButton has a DropDown of type ToolStripDropDown that contains a ToolStripControlHost which contains a Label. I have assigned a ContextMenuStrip to my Label. When I show the DropDown and right-click on the label, the ContextMenuStrip displays correctly, but the original DropDown is dismissed.

我能理解底层code至prevent两个ToolStripItems显示器在同一时间的存在,我假设这就是我在这里运行的研究。任何人都知道的办法解决它?

I can understand the existence of underlying code to prevent the display of two "ToolStripItems" at the same time and I'm assuming that's what I'm running in to here. Anybody know of a way around it?

推荐答案

原来这可以完成与上ToolStripDropDown类创造性地使用了AutoClose属性:

Turns out this can be accomplished with creative use of the AutoClose property on the ToolStripDropDown class:

首先,标签上点击右键,设置ToolStripDropDown的AutoClose为false,并显示上下文菜单。
其次,在文本菜单解雇,重置ToolStripDropDown的AutoClose为true。

First, on Label Right Click, set AutoClose of the ToolStripDropDown to false and show context menu.
Second, on ContextMenu dismissal, reset AutoClose of the ToolStripDropDown to true.

这篇关于显示从ToolStripDropDown的ContextMenuStrip没有解雇ToolStripDropDown的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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