如何找到标准Winforms TextBox的插入符号的屏幕位置?
答案 0 :(得分:9)
您只能使用原生互操作:GetCaretPos
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetCaretPos(out Point lpPoint);
答案 1 :(得分:2)
我一直在使用TextBox.GetPositionFromCharIndex函数。它给出了相对于TextBox左上角的坐标。