如何获取RichTextBox控件当前行? [英] How to get the current line in a RichTextBox control?
本文介绍了如何获取RichTextBox控件当前行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
说我点击一个RichTextBox控件中的某个地方。我怎样才能得到当前行插入符当前是否对?
Say I clicked somewhere inside a RichTextBox control. How can I get the current line the caret is currently on?
顺便说一下,这是检索该行的整个文本串
Btw this is to retrieve the whole text string of that line.
推荐答案
这就是<一href="http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.getlinefromcharindex.aspx">RichTextBox.GetLineFromCharIndex()确实。通过SelectionStart属性值。
That's what RichTextBox.GetLineFromCharIndex() does. Pass the SelectionStart property value.
这篇关于如何获取RichTextBox控件当前行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文