How can I find the screen position of the caret for a standard Winforms TextBox?
+4
A:
You can do it only with native interop: GetCaretPos
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetCaretPos(out Point lpPoint);
arbiter
2009-06-23 09:11:28
Worked like a charm. Thanks!
bbqfrito
2009-06-23 13:18:53
A:
I have been using the TextBox.GetPositionFromCharIndex function. It gives coordinates relative to the top left of the the TextBox.
Venkat D.
2010-07-18 22:20:48