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

有帮助吗?

解决方案

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

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

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top