在工具提示里面SpecificText使用鼠标悬停的RichTextBox [英] ToolTip in SpecificText inside RichTextBox using MouseOver
问题描述
IM在代码编辑器和IM的工作只是想知道如何在文本提示自通常的工具在C#中使用鼠标悬停功能。是这样的:
im working on a code-editor and im just wondering how to make tooltip in text since its usually on tools in c# with a mouseover functionality . something like this:
样品塞纳里奥,
当我在RichTextBox中键入ABC和具有消息将鼠标放置到它的工具提示这是字母将出现。
一样以123中输入RichTextBox的和得到鼠标悬停这是一个数量将会出现。
when i type "abc" in richtextbox and mouseover it ToolTip with a Message "this is an alphabet" will appear . same as with "123" inputted in richtextbox and get mouseover "this is a number will appear" .
反正有我能做到这一点?没有水浸或使用任何按键?只是在文字鼠标悬停?感谢很多真正需要帮助
is there anyway i can do that? without flooding or using any keypress? just mouseover in text? thanks a lot really need a help .
推荐答案
试试这个代码:
private void richTextBox1_MouseHover(object sender, EventArgs e)
{
double x;
if (double.TryParse(richTextBox1.Text, out x))
{
toolTip1.Show(this is a number will appear",richTextBox1);
}
else
{
toolTip1.Show("this is an alphabet",richTextBox1);
}
}
这篇关于在工具提示里面SpecificText使用鼠标悬停的RichTextBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!