如何在文本索引中显示工具提示而不是在MouseCursor上显示?
问题描述:
工具提示可能位于文本索引而不是鼠标光标中吗?如何在文本索引中显示工具提示而不是在MouseCursor上显示?
请注意即时通讯工具提示窗口中的文本。
这里是我的样品提示:
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
//toolTip1.ShowAlways = true;
toolTip1.ToolTipTitle = "<)(Text ToolTip)(>";
toolTip1.UseFading = true;
toolTip1.UseAnimation = true;
参数:
for (int i = 0; i < keywords.Length; i++)
{
if (keywords[i] == token)
{
// Apply alternative color and font to highlight keyword.
HighlighType.keywordsType(rtb);
toolTip1.Show("this is a keyword", rtb); //&
break;
}
}
当关键字将在RichTextBox的类型,像例如 “如”,提示将出现,但在仅限MOUSEcursor,我希望它靠近textindex。
是可能的吗?非常感谢!
答
你需要ToolTip.Show (String, IWin32Window, Point)
方法与GetPostitionFromCharIndex
让您从GetPostitionFromCharIndex
文本的Point
结合起来,把它传递给ToolTip.Show
它更容易,你搜索已经实现了在那里的东西(好像不是这样简单话题)。 – Tigran 2013-04-29 11:03:19
其刚刚变得硬先生,因为tooltip是为工具,但我使它的文本就像在实际的代码编辑器 – Elegiac 2013-04-29 11:06:24
就像这样的先生:http://www.codeproject.com/Articles/464085/WinForms-RichTextBox-ToolTip- like-Visual-Studios,但是我不知道他使用了什么特别的事件,如果它是鼠标移动或者是什么,以及如何在你将它移动到文本上时做到这一点:/ .sorry newbie here :( – Elegiac 2013-04-29 11:10:41