本文整理汇总了C#中System.Windows.Forms.Document.GetText方法的典型用法代码示例。如果您正苦于以下问题:C# Document.GetText方法的具体用法?C# Document.GetText怎么用?C# Document.GetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Document
的用法示例。
在下文中一共展示了Document.GetText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getReadOnlyRichTextBoxCollectionByParagrapheCollection
//根据段落集合生成ReadOnlyRichTextBox控件集合
private List<RichTextBox> getReadOnlyRichTextBoxCollectionByParagrapheCollection(string keyWord, List<Paragraph> paragraphCollection, Document searchDocument)
{
List<RichTextBox> readOnlyRichTextBoxCollection = new List<RichTextBox>();
if (paragraphCollection.Count != 0 && searchDocument != null)
{
for (int i = 0; i < paragraphCollection.Count; i++)
{
RichTextBox roRTB = new RichTextBox();
roRTB.ReadOnly = true;
roRTB.MouseClick += new MouseEventHandler(this.flowLayoutPanel_MouseClick);
roRTB.MouseWheel += new MouseEventHandler(flowLayoutPanel1_MouseWheel);
roRTB.ContentsResized += roRTB_ContentsResized;
roRTB.Width = this.flowLayoutPanel.Width - 25;
//roRTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
Paragraph paragraph = paragraphCollection[i];
roRTB.Tag = paragraph;
string par_Text = searchDocument.GetText(paragraph.Range);
int startPosition = 0;
roRTB.Text = par_Text;
while (par_Text.IndexOf(keyWord, startPosition) >= 0)
{
int curPosition = par_Text.IndexOf(keyWord, startPosition);
roRTB.Select(curPosition, keyWord.Length);
roRTB.SelectionColor = Color.Red;
startPosition = curPosition + keyWord.Length;
}
//this.flowLayoutPanel.Controls.Add(roRTB);
readOnlyRichTextBoxCollection.Add(roRTB);
}
}
return readOnlyRichTextBoxCollection;
}