使用MouseOver在RichTextBox内的SpecificText中的工具提示
我正在编写一个代码编辑器,我只是想知道如何在文本中制作工具提示,因为它通常在c#中具有鼠标hoverfunction的工具。 像这样的东西:
样本Senario,
当我在richtextbox中键入“abc”并将其鼠标hover时,将显示带有“这是一个字母”消息的ToolTip。 与在richtextbox中输入的“123”相同并获得鼠标hover“这将是一个数字将出现”。
无论如何我能做到吗? 没有洪水或使用任何按键? 只是鼠标hover在文字中? 非常感谢真的需要帮助。
试试此代码:
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); } }