gpt4 book ai didi

c# - 自定义控件的工具提示

转载 作者:太空狗 更新时间:2023-10-29 22:34:40 27 4
gpt4 key购买 nike

我创建了一个自定义控件(继承自 UserControl),其中包含一些控件(标签、文本框、 slider ),并在 Designer 中为其分配了一个 supertooltip(来自 devComponents dotnetbar;与 normal 相同的问题;检查图片)。

但是工具提示没有出现。在“正常”控件上它可以工作,所以这是自定义控件的问题。

知道哪里出了问题吗?

编辑:这是一个示例:Download

在制作示例时,我认为我发现了失败。仅当鼠标悬停在父级上时才会出现工具提示。可能的?如果是:知道如何解决吗?

alt text

最佳答案

在用户控件上设置工具提示当您将鼠标悬停在用户控件的“空” Canvas 上时显示工具提示,而不是当您将鼠标悬停在作为用户控件一部分的子控件上时。这是设计使然,如果您想要其他行为,则需要手动实现一些解决方法。

提到的一个建议(最初来自 www.msnewsgroups.net,但不再可用):

The easy way to handle this problem is to have your UserControl export a ToolTop property that, when it's set, just sets the ToolTip properties of all of its component controls. The get accessor can just return the ToolTip from any component within the UserControl, as they'll all be the same.

The only downside to doing it this way is that the tool tip will be redisplayed whenever the user moves from one component to another within the user control, so the tool tip can become annoyingly persistent at times.

关于c# - 自定义控件的工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4265918/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com