Winforms: Screen Location of Caret Position(Winforms:插入符号位置的屏幕位置)

本文介绍了Winforms:插入符号位置的屏幕位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can I find the screen position of the caret for a standard Winforms TextBox?

推荐答案

您只能使用本机互操作来做到这一点:GetCaretPos

You can do it only with native interop: GetCaretPos

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

这篇关于Winforms:插入符号位置的屏幕位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!