Alex Rivera | Logout

How to hide the caret in a RichTextBox?

Asked 2009-02-24T15:56:31.533
11

Just like the title: I've searched the web for an answer, but i was not able to find a way to hide the caret of a RichTextBox in VB.NET.

I've tried to set the RichTextBox.Enabled property to False and then change the background color and foreground color to non-grey ones but that did not do the trick.

Thanks in advance.

Edit
Report

1 Answer

2

You can use the HideCaret API function, Check it out on www.pinvoke.net. The trick is to know when to call it. A very simple and dirty solution is to start a one-shot timer in the RTF's Enter event. Trapping the correct message in the WndProc as nobugs suggestes is better, unfortunately the message trapped is wrong...

answered 2009-02-24T17:52:15.297

Your Answer