Playing Hide-the-Caret

  • Thread starter Thread starter randy
  • Start date Start date
R

randy

Hi,

I'm trying to set up a richtextbox to behave like the text
area in a web browser, i.e. no caret, and a cursor that
changes depending on what it's hovering over.

I've been setting the cursor by testing the "Selection"
properties of the text the cursor is over. This requires
setting the SelectionStart property, which causes the
caret to move. Ugh!

I tried using the user32.dll hideCaret function in an
attempt to remove the caret. This works inconsistently,
even when I place hideCaret calls all over the place.
Grrrr!

Is there an elegant solution to removing the caret?
Perhaps if I could control the caret color...

Any suggestions?

Randy
 
This may help, I have not tested it on VB.NET

http://www.vb-helper.com/HowTo/nocaret.zip

Uses the HideCaret API function. Unfortunately, Visual Basic restores the
caret frequently. Subclass and hide the caret whenever the TextBox gets
message WM_PAINT or &H100E (whatever that is).

Regards - OHM
Hi,

I'm trying to set up a richtextbox to behave like the text
area in a web browser, i.e. no caret, and a cursor that
changes depending on what it's hovering over.

I've been setting the cursor by testing the "Selection"
properties of the text the cursor is over. This requires
setting the SelectionStart property, which causes the
caret to move. Ugh!

I tried using the user32.dll hideCaret function in an
attempt to remove the caret. This works inconsistently,
even when I place hideCaret calls all over the place.
Grrrr!

Is there an elegant solution to removing the caret?
Perhaps if I could control the caret color...

Any suggestions?

Randy

Regards - OHM# (e-mail address removed)
 
Back
Top