WPF SL 获取RichTextBox 的内容(string)

2420阅读 0评论2016-03-24 dyli2000
分类:C#/.net

WPF:
  1. private string GetText(RichTextBox richTextBox)
  2. {
  3.         TextRange textRange = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);
  4.         return textRange.Text;
  5. }

ST:
  1. var run = describeRichTextBox.Selection.Start.Parent as Run;
  2. if (run != null)
  3.  {
  4.     string str = run.Text;
  5.  }

转自网址:
http://blog.csdn.net/wushang923/article/details/11048645
上一篇:Winform label文本颜色修改问题
下一篇:正则表达式类Regex类用法探究