I want to change cursor to the HAND when mouse pointer is over a bold word in RichTextBox. How to do this?
Add this function to richtextbox.OnMouseMove event.
private void richTextBox2_MouseMove(object sender, MouseEventArgs e)
{
int c = richTextBox2.GetCharIndexFromPosition(new Point(e.X, e.Y));
richTextBox2.Select(c, 1);
if (richTextBox2.SelectionFont.Bold)
{
richTextBox2.Cursor = Cursors.Hand;
}
else
{
richTextBox2.Cursor = Cursors.Default;
}
}
You just need 1 char to know if it is bold.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With