473,545 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing the blinking cursor in a TextBox

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

Feb 21 '07 #1
3 11943
On 21 Feb 2007 09:09:20 -0800, fb*******@gmail .com wrote:
>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

Feb 22 '07 #2
On Thu, 22 Feb 2007 13:22:49 +0000, rossum <ro******@coldm ail.com>
wrote:
>On 21 Feb 2007 09:09:20 -0800, fb*******@gmail .com wrote:
>>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?

Alternativel y 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,
--
Philip Daniels
Feb 22 '07 #3
On Thu, 22 Feb 2007 14:34:34 +0000, Ph***********@f oo.com wrote:
>On Thu, 22 Feb 2007 13:22:49 +0000, rossum <ro******@coldm ail.com>
wrote:
>>On 21 Feb 2007 09:09:20 -0800, fb*******@gmail .com wrote:
>>>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?

Alternative ly 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,
My mistake. Thanks for the correction.

rossum

Feb 22 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
383
by: malbanese | last post by:
I am building an ASP.Net application that occasionaly "stalls" while running a server side process like a large database update. During this tine the user does not get any feedback as to what is going on, an is likely to try clicking things multiple times which could result in an unwanted outcome. Is there any way to change the mouse pointer to...
1
2789
by: MrNobody | last post by:
How can I customize DataGrid so that when the mouse hovers over certain columns the cursor changes to the Cursors.Hand cusror? I was unable to use the MouseEnter/MouseLeave events on DataGrid itself because those events do not use the MouseEventArgs, so I can't get the X Y position to determine if the cursor should change for that column
1
3289
by: Tomas Kepic | last post by:
Hi, how can I change default cursor to wait cursor in ASP? In Windows-Based Applications I'm using: Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; How can I use something similar in ASP? Thanks, Tomas
3
1539
by: larry mckay | last post by:
does anyone have a code sample that changes the mouse cursor to an hourglass or waitcursor ? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
2
9021
by: Jim Frazer | last post by:
Hi, I'm working on an application in C# that will allow the user to create simple CAD drawings on a CEPC system. I would like to be able to change the cursor shape depending on the drawing mode selected by the user. I started out by setting up P/Invokes for LoadCursor and SetCursor. Calling LoadCursor followed by SetCursor does allow me...
0
1882
by: =?Utf-8?B?Q29yZXlNY0s=?= | last post by:
I'm working on a TextBox control (in C# using .NET 2.0) that allows fields (like MS Office's mail merge feature). I want the editor to treat the field as though it was a single character. The user shouldn't be able to delete part of the field or select only part of the field. For example, a line might look like: «Image» shot on «Date» at...
2
2829
by: shammif2 | last post by:
hello all again. I'm still working with my text editor. now i want to get the cursor position in the richtext box. any way to do that?
0
243
by: Dom | last post by:
I need to change the cursor during certain events. The help screen seems to say to use the Cursor.Current property, but that seems to change the cursor for only a split second. Things work fine if I just do: Cursor = new Cursor (Filename) What is the purpose of the Current property? Also, can anyone recommend a good free cursor...
5
8433
by: michels287 | last post by:
Right now I have a touchscreen with a virual keyboard. I would like to create arrow keys. If the user messed up the inputted text, he can move the blinking cursor left one space at a time between inputted characters to add a letter. Then a button to move the blinking cursor back to the end of the inputted text. Private Sub Left...
0
7405
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7659
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7428
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7760
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5975
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5334
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1887
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1019
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
709
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.