By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,892 Members | 1,088 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,892 IT Pros & Developers. It's quick & easy.

how to create a flashing text cursor

P: n/a

I want to add a flashing text cursor to my selfmade user control.
Is there an existing class availible for this problem or do I have to write
a thread, which flashs the cursor?

THX for your help

Thilo
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You need to use the Win32 Caret API as imported by the following code...

[DllImport("User32.dll")]

protected static extern int CreateCaret(

System.IntPtr hWnd, // handle to owner window

System.IntPtr hBitmap, // handle to bitmap for caret shape

int nWidth, // caret width

int nHeight // caret height

);

[DllImport("User32.dll")]

protected static extern int ShowCaret(

System.IntPtr hWnd // handle to window with caret

);

[DllImport("User32.dll")]

protected static extern int HideCaret(

System.IntPtr hWnd // handle to window with caret

);

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Thilo Frank" <Th********@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...

I want to add a flashing text cursor to my selfmade user control.
Is there an existing class availible for this problem or do I have to
write
a thread, which flashs the cursor?

THX for your help

Thilo

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.