Winforms:插入位置的屏幕位置

如何找到标准Winforms TextBox的插入符号的屏幕位置?

您只能使用本机互操作: GetCaretPos

[DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool GetCaretPos(out Point lpPoint); 

我一直在使用TextBox.GetPositionFromCharIndex函数。 它给出了相对于TextBox左上角的坐标。