Reputation: 923
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!
Upvotes: 1
Views: 632
Reputation: 175766
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)
Upvotes: 1