显示从ToolStripDropDown的ContextMenuStrip没有解雇ToolStripDropDown

编程入门 行业动态 更新时间:2024-10-28 16:27:03
本文介绍了显示从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

本文发布于:2023-11-08 11:55:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1569300.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ToolStripDropDown   ContextMenuStrip

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!