Changing the blinking cursor in a TextBox

F

fbergroth

Hi, I'm quite new to C# allthough I've been programming in other
languages for quite a while.

I'd like to change the blinking cursor inside a TextBox, I guess I
must derive the class and override the OnPaint()-method, however I
have no clue what to do next. I want to be able to switch the blinking
cursor to a solid, non-blinking, cursor and preferable have it with a
color.

So, how should I do that?

Thanks
 
R

rossum

Hi, I'm quite new to C# allthough I've been programming in other
languages for quite a while.

I'd like to change the blinking cursor inside a TextBox, I guess I
must derive the class and override the OnPaint()-method, however I
have no clue what to do next. I want to be able to switch the blinking
cursor to a solid, non-blinking, cursor and preferable have it with a
color.

So, how should I do that?

Thanks
Have you tried the options in the TextBox.Cursor property?

Alternatively it is possible to construct your own Forms.Cursor object
and assign that to the TextBox.Cursor.

rossum
 
P

PhilipDaniels

Have you tried the options in the TextBox.Cursor property?

Alternatively it is possible to construct your own Forms.Cursor object
and assign that to the TextBox.Cursor.

rossum

Need to get the right terminology:

Cursor = the pointer that moves when you move the mouse

Caret = the line/block/bitmap inside a control that usually indicates
the current insertion point. This is actually a Windows resource
shared among all applications (there is only ever 1 caret in existence
at any one time).

AFAIK controlling the caret has to be done via P/Invoke. I've never
had to do it but a google groups search for ".Net caret" brings up
some promising links, and if you change the help for Visual Studio so
that it is unfiltered and type "caret" into the search box on the
Index tab then you will find some hits in the MFC documentation which
should help.

Good luck,
 
R

rossum

Need to get the right terminology:

Cursor = the pointer that moves when you move the mouse

Caret = the line/block/bitmap inside a control that usually indicates
the current insertion point. This is actually a Windows resource
shared among all applications (there is only ever 1 caret in existence
at any one time).

AFAIK controlling the caret has to be done via P/Invoke. I've never
had to do it but a google groups search for ".Net caret" brings up
some promising links, and if you change the help for Visual Studio so
that it is unfiltered and type "caret" into the search box on the
Index tab then you will find some hits in the MFC documentation which
should help.

Good luck,
My mistake. Thanks for the correction.

rossum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top