private void tm_Tick(object sender, EventArgs e) { tm.Stop(); //get place under mouse var place = fctb.PointToPlace(lastMouseCoord); //check distance var p = fctb.PlaceToPoint(place); if (Math.Abs(p.X - lastMouseCoord.X) > fctb.CharWidth * 2 || Math.Abs(p.Y - lastMouseCoord.Y) > fctb.CharHeight * 2) return; //get word under mouse var r = new Range(fctb, place, place); string hoverWord = r.GetFragment("[a-zA-Z]").Text; if (hoverWord == "") return; //show tooltip string text = "Help for " + hoverWord; tt.ToolTipTitle = hoverWord; tt.SetToolTip(fctb, text); tt.Show(text, fctb, new Point(lastMouseCoord.X, lastMouseCoord.Y + fctb.CharHeight)); }
private TFunc GetSelectedFunction() { Place place = fastColoredTextBox1.Selection.Start; var r = new Range(fastColoredTextBox1, place, place); string hoveredWord = r.GetFragment("[_a-zA-Z0-9]").Text; ListViewItem itm = listView3.FindItemWithText(hoveredWord); if (itm != null) return (itm.Tag as TFunc); return null; }