0
votes

I'm working with code editor and I just wanted to add tooltip for everytext that Ill inputed in richtextbox (served as code-editor) .

Till I see this guide right here:

http://www.codeproject.com/Articles/464085/WinForms-RichTextBox-ToolTip-like-Visual-Studios

It's the same thing that I want to find though the time I download it there's a file missing specifically its mainform .

So I just want to ask if how to do it without using any .dll file.

Sample: I type "abc" in rtb then when I mouse hover it a tooltip with text: this is an alphabet will appear. Same as with "123" a when I mousehover tooltip with text: this is a number will appear.

1
you want in your RTB, When I type "C# is Awesome" you need to get Awesome only in Tooltip or Full Sentence - Akshay Joy
different text as i inputed in rtb could be if possible . if i inputted "C# is Awesome" tooltip with message "its really Awesome" will appear .something like that ... just like what in the link shows but its ok in me if its just a simple tooltip and dont have border ... - Elegiac
"Its really" is Commmon words has to attach with Last Word you typed in RTB. Please tell me the sample Input and output - Akshay Joy
inputtext in rtb-> abc = outputtext (when text get mouseover)-> this is an alphabet . and if its 123 -> inputtext (when text get mouseover)-> this is a number . - Elegiac
Please check the Answer , Please let me know Is this waht you are expecting? - Akshay Joy

1 Answers

0
votes

You can try this Sample, One way to Achieve

   using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public string rtbTypedText = "";
        public Form1()
        {
            InitializeComponent();
        }





        private void richTextBox1_Leave(object sender, EventArgs e)
        {


           // MessageBox.Show(text);

        }

        private void richTextBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (char.IsWhiteSpace(e.KeyChar))
            {
                int result = 0;
                string s = richTextBox1.Text;

                string text = "";
                string[] sp = s.Split(' ');

                if (sp.Length == 0)
                    rtbTypedText = s;
                else
                    rtbTypedText = sp[sp.Length - 1];


                bool typeStatus = int.TryParse(rtbTypedText, out result);
                if (typeStatus == true)
                    toolTip1.Show("It is a Number", richTextBox1);
                else
                    toolTip1.Show("It is an Alphabet", richTextBox1);
            }

        }
    }
}

enter image description here