- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
当您将鼠标悬停在 ToolStripItems 上时,即使它们所在的窗体不在焦点上,ToolStripItems 也会显示事件突出显示。但是,除非表单获得焦点,否则它们不会显示工具提示。我看过 ToolStrip 'click-though' hack .任何人都知道如何让 ToolStripButton 在其父窗体未处于焦点时显示其工具提示?
谢谢!
最佳答案
问题是像 ToolStripButton 或 ToolStripDropDownButton 这样的 ToolStrip“控件”不继承自 Control。现在我通过在用户将鼠标悬停在按钮上时聚焦 ToolStrip 来解决这个问题。按钮的 MouseHover 事件触发得太晚了——在“显示工具提示”代码运行之后,所以我扩展了 ToolStripDropDownButton 类并使用了我的新按钮。此方法适用于任何其他继承自 ToolStripItem 的类似按钮的类
public class ToolStripDropDownEx : ToolStripDropDownButton
{
public ToolStripDropDownEx(string text)
{
}
protected override void OnMouseHover(EventArgs e)
{
if (this.Parent != null)
Parent.Focus();
base.OnMouseHover(e);
}
}
关于c# - 在非焦点 ToolStripItem 上显示工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/143058/
我需要将一组自定义 ToolStripItem(包含附加属性 formReference)添加到 ToolStripPanel 但它们不会出现一些原因。 添加项目的代码: foreach (Form
我已经成功地创建了带有用户控件的 DragDrop 功能。现在,我正在尝试在某些组件(例如 ToolStripButton)上启用 DragDrop 功能。 基类 ToolStripItem 支持 A
我通过以下方式将字符串(项目)动态添加到 ToolStripItemCollection: Dim onClickHandler As System.EventHandler = New System
当您将鼠标悬停在 ToolStripItems 上时,即使它们所在的窗体不在焦点上,ToolStripItems 也会显示事件突出显示。但是,除非表单获得焦点,否则它们不会显示工具提示。我看过 Too
我需要保存和恢复表单上特定控件的设置。 我遍历所有控件并返回名称与我想要的控件匹配的控件,如下所示: private static Control GetControlByName(string na
我有一个 DGV 的上下文菜单条。它有一个名为“ChangeTo”的 toolstripitem,它分支成一组根据使用的配置文件动态创建的项目。当我运行具有 Rt-Click -> Change To
当我查找它时,他们将其列为具有 .Checked 属性。但在 Visual Studio 和 msdn 上, 它没有列出 Checked 属性的任何子项。 ContextMenuStrip menu
我正在开发一个 MDI Windows Forms 应用程序。我的父窗体有 ToolStrip 菜单和一些 ToolStripDropDownButtons。我想根据用户。 这是我为管理此问题而编写的
在 Windows 窗体中 - 如果 MenuStrip 的下拉项有工具提示和下拉项本身,则工具提示将有大约 50% 的机会显示在 ToolStripItems 下方。 解决方法是什么? 要重现,您可
我想以编程方式用项目填充 ToolStrip。 toolStrip1.LayoutStyle 必须是 ToolStripLayoutStyle.Table。但是我无法更改项目的宽度,即使我这样做了,宽
我是一名优秀的程序员,十分优秀!