Winforms: Screen Location of Caret Position

前端 未结 2 1448
温柔的废话
温柔的废话 2021-01-19 07:45

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

2条回答
  •  余生分开走
    2021-01-19 08:31

    You can do it only with native interop: GetCaretPos

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

提交回复
热议问题