我有一个的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
发布评论