Hi,
I've been playing around now for several hours with the question: What would be the best way to highlight a sentence? Keep in mind some sentences end with "?" or "..." By clicking on a button I would like the next sentence to be highlighted. Has anyone worked on this?
Here's a code I have been working with. However, it only highlights the last word of a sentence, but not the last entire sentence.
How can I set the start of the selection to myNewSentenceStartPos ?
Thank you,
Karl
I've been playing around now for several hours with the question: What would be the best way to highlight a sentence? Keep in mind some sentences end with "?" or "..." By clicking on a button I would like the next sentence to be highlighted. Has anyone worked on this?
Here's a code I have been working with. However, it only highlights the last word of a sentence, but not the last entire sentence.
private void radButtonElement1_Click(object sender, EventArgs e) { this.radRichTextBox1.ChangeTextHighlightColor(System.Drawing.Color.White); this.radRichTextBox1.Document.Selection.Clear(); this.radRichTextBox1.Document.Selection.AddSelectionStart(myNewSentenceStartPos); myEndPos.MoveToCurrentWordEnd(); do { string word = myStartPos.GetCurrentSpanBox().Text; if (word.Contains(".")) { DocumentPosition wordEndPosition = new DocumentPosition(myStartPos); wordEndPosition.MoveToCurrentWordEnd(); this.radRichTextBox1.Document.Selection.Clear(); this.radRichTextBox1.Document.Selection.AddSelectionStart(myNewSentenceStartPos); this.radRichTextBox1.Document.Selection.AddSelectionEnd(wordEndPosition); this.radRichTextBox1.ChangeTextHighlightColor(System.Drawing.Color.Aqua); myStartPos = myEndPos; myNewSentenceStartPos = myEndPos; break; } else { } } while (myStartPos.MoveToNextWordStart()); }How can I set the start of the selection to myNewSentenceStartPos ?
Thank you,
Karl
