如何在RichTextBox中获取光标位置 [英] How to get cursor position in a richtextbox

查看:107
本文介绍了如何在RichTextBox中获取光标位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取Richtextbox的当前光标位置

tnx

how do i get the current cursor position of richtextbox

tnx

推荐答案

使用属性SelectionStart.

如果SelectionLength不为零,则该问题没有确切含义:SelectionStartSelectionStart + SelectionLength都可以视为光标位置.当用户按下向左或向右键取消选择文本时,任何一个点都可以成为光标位置-请尝试查看.

—SA
Use the property SelectionStart.

If SelectionLength not zero, the question has no exact meaning: both SelectionStart and SelectionStart + SelectionLength could be considered as the cursor position. Either point can became a cursor position when the text is deselected when a user presses left or right key — try it to see.

—SA


这篇关于如何在RichTextBox中获取光标位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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