在文本框中查找插入符号的位置 [英] Finding the position of the caret in a TextBox

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

问题描述

我需要知道插入符在TextBox中的位置,以便可以在其附近弹出一个上下文菜单.如何找到它的位置(不是字符索引)?

I need to know the position of the caret in a TextBox so I can pop up a context menu near it. How do I find its placement (not character index)?

推荐答案

找到本文描述如何做我需要做的事情.事实证明,您可以同时从GetRectFromCharacterIndex设置文本框的PlacementTarget,并且可以使用.

Found this article describing how to do what I need done. Turns out you can set both the PlacementTarget of the textbox and the PlacementRectangle from GetRectFromCharacterIndex and it will work.

这篇关于在文本框中查找插入符号的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆