Winforms:插入位置的屏幕位置
题
如何找到标准Winforms TextBox的插入符号的屏幕位置?
解决方案
您只能使用本机互操作: GetCaretPos
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetCaretPos(out Point lpPoint);
其他提示
我一直在使用TextBox.GetPositionFromCharIndex函数。它给出了相对于TextBox左上角的坐标。
不隶属于 StackOverflow