469,954 Members | 1,759 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,954 developers. It's quick & easy.

Playing Hide-the-Caret

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
Nov 20 '05 #1
2 2637
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

randy wrote:
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# On**********@BTInternet.com
Nov 20 '05 #2
Ugh. What a mess.

I couldn't get this to work.

Thanks anyway...

Randy
-----Original Message-----
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 thecaret frequently. Subclass and hide the caret whenever the TextBox getsmessage WM_PAINT or &H100E (whatever that is).

Regards - OHM

randy wrote:
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# On**********@BTInternet.com
.

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Atz | last post: by
12 posts views Thread by Jochen Daum | last post: by
2 posts views Thread by Frances Del Rio | last post: by
2 posts views Thread by MOHSEN KASHANI | last post: by
1 post views Thread by Chris Kettenbach | last post: by
2 posts views Thread by MAF | last post: by
3 posts views Thread by sivaraman.S | last post: by
5 posts views Thread by xrado | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.