C#工具提示显示时间不足 [英] C# tooltip doesn't display long enough

查看:31
本文介绍了C#工具提示显示时间不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鼠标悬停在图像上时,我有一个工具提示:

I have a tooltip that is appearing on mouse hover on an image:

ToolTip tt = new ToolTip();
protected virtual void pictureBox_MouseHover(object sender, EventArgs e)
{
    tt.InitialDelay = 0;
    tt.SetToolTip(this.pictureBox, "Click 'LIVE ...");
}

我的问题是我的文本太长,并且工具提示消失得太快.如何使工具提示显示更长的时间?

My problem is that my text is rather long, and the tooltip disappears too fast. How can I get the tool tip to be displayed for longer?

推荐答案

设置 更新:我的错误:

您可以延迟弹出窗口的最长时间为5000毫秒.对于更长的持续时间,请使用Show方法来控制显示工具提示的确切时间.

The maximum time you can delay a popup is 5000 milliseconds. For longer durations, use the Show method to control the exact moment when the ToolTip is displayed.

因此,使用此方法不能使工具提示显示的时间超过5秒-而是当用户将鼠标悬停在图片框上时,需要使用显示"显式显示工具提示.只需将您对 SetToolTip 的调用替换为在 MouseHover 事件处理程序中进行 Show 的调用即可:

So you can't get the tool tip to be displayed for longer than 5 seconds using this method - instead you need to use the Show to explicitly show the tool tip when the user hovers over the picturebox. Just replace your call to SetToolTip with one to Show in your MouseHover event handler:

ToolTip tt = new ToolTip();
protected virtual void pictureBox_MouseHover(object sender, EventArgs e)
{
    tt.Show("Click 'LIVE ...", this.pictureBox, 10000);
}

这篇关于C#工具提示显示时间不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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