如何找到标准 Winforms TextBox 的插入符号的屏幕位置?
问问题
2223 次
2 回答
8
您只能使用本机互操作执行此操作:GetCaretPos
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetCaretPos(out Point lpPoint);
于 2009-06-23T09:11:28.667 回答
2
我一直在使用 TextBox.GetPositionFromCharIndex 函数。它给出相对于文本框左上角的坐标。
于 2010-07-18T22:20:48.123 回答