Hover tooltip on specific words in rich text box? - c#

I'm trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

You can use MouseMove and then GetCharIndexFromPosition to determine which character the mouse is over, then display the associated tooltop.

Related

Creating dialogue box to choose answer during runtime from button

I am working on a project with a third-person template added. I want to have a box where text popups along with two buttons yes and no. I added Text and a button from UI options but my mouse is not going over Button(the highlighted colour is not coming up). Is it because the mouse is already assigned to move my player camera or something, or do I need to do code something particular ?
Thank you

Change font when mouse is over a certain text, and revert back. (Event Handler)

I have an assignment were the requirements are to create a grid of textboxes (no I cant use datagridview or import libraries).
Now since text boxes are a bit rudimentary, an Idea popped into my head to do like excel (highlighting cells). now I wish to highlight what is written inside a textbox when:
-I click on it,
-when mouse hovers on it
-reverts back when another text box is selected and or mouse is away from the cell.
For eg:
when clicked and writing in the cell its red,
when another cell is clicked but mouse is hovering on another cell, the text on which the mouse is hovering becomes blue,
when I click on another cell and mouse is not hovering over the cell it returns to being black.
I wish to used event handlers.
I know the method syntax and what not, but what do you call the thingy (ie. .textchange to change text .validate to validate what is written, .click to show what is clicked. etc)
also if anyone can provide a link of the list of all event handlers which can be utilised will be of immense help.
I wanna pawn this assignment.
already have 3 event handlers for other things, currently using
textchanged,
validate,
click.

Get location of the text box cursor

Note: I am talking about the text box cursor (aka the vertical line that shows where you're typing. Not the mouse)
As the nice note says above, I'm trying to get the location of the text cursor as a Point so I can show a popup below it. How do I do this?
Text box has a GetRectFromCharacterIndex method that you can use. For example:
textbox.GetRectFromCharacterIndex(textbox.CaretIndex)

How can I make a TextBox scroll when the mouse wheel is turned in another control?

I'm making an IRC client where the chat is displayed in a multi-line TextBox control named chatBox. Below the chat there is a single-line textBox named editBox where the user enters messages. I want the user to be able to scroll in the chatBox even while the editBox has the focus. Is there any way I can do that?
I've looked at the events for textBox and I can't find anything resembling a scroll event, and I've searched Google for an answer with no success.
You can't scroll directly, but you can move the cursor. You can move the cursor to the end of a text box, for example, with textBox.SelectionStart = textBox.Text.Length.
By manipulating the selection you can emulate scrolling by using textBox.ScrollToCaret().

How can I select the previous char from the cursor position in a RichTextBox

I am making an combobox that changes the richTextBox's font, and I would like to be able to automatically change the combobox's selection when I click on a specific text in it, matching its font. I thought, it would be appropriate to add an onClick event on the text. This event would take the curent cursor position and make a selection with the range between the previous position and the current. I would be able to get the font from this selection.
If you know how, or can see a better way to complete this, thanks for replying!
You don't need to actually create a selection range, just looking at rtb.SelectionFont.Name will return the font name from the current caret position (i.e. without needing to select anything)

Categories