how to create a flashing text cursor

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
Back
Top