C# RichTextBox 获取当前显示部分的文字

int start = richTextBox1.GetCharIndexFromPosition(new Point(0, 0));
int end = richTextBox1.GetCharIndexFromPosition(new Point(richTextBox1.ClientSize.Width, richTextBox1.ClientSize.Height-1));
var displayedText = richTextBox1.Text.Substring(start,end-start);
MessageBox.Show(displayedText);

 Created by colleague Dayong Wang 20150828

posted @ 2015-08-28 10:01  No5Meters  阅读(1117)  评论(0编辑  收藏  举报