示例#1
0
 internal void Select(Selection selection)
 {
     Select(selection.Start, selection.Length);
 }
示例#2
0
 public void CopySpecial()
 {
     if (!Editable)
         return;
     Selection oldSelection = new Selection(SelectionStart, SelectionLength);
     string copyThis;
     if (Util.IsRichTextBoxBroken())
     {
         copyThis = Text.Substring(SelectionStart, SelectionLength);
     }
     else
     {
         copyThis = RtfConverter.Serialize(Rtf, SelectionStart, SelectionLength);
     }
     Clipboard.SetDataObject(new DataObject(DataFormats.StringFormat, copyThis));
     Select(oldSelection);
 }
示例#3
0
 public void FindText(string text, bool startFromBeginning, bool searchOtherSnippets)
 {
     int found = -1;
     Selection oldSelection = null;
     if (Editable)
     {
         oldSelection = new Selection(SelectionStart, SelectionLength);
         int startFrom = 0;
         if (!startFromBeginning)
             startFrom = SelectionStart + SelectionLength;
         found = Find(text, startFrom, RichTextBoxFinds.None);
     }
     if (found == -1 || (found == oldSelection.Start && text.Length == oldSelection.Length))
     {
         // careful!  this actually does the find in other snippets if
         // necessary
         if (!searchOtherSnippets || !FindInOtherSnippets(text))
         {
             MessageBox.Show("Text '" + text + "' not found.", MainForm.DialogCaption, MessageBoxButtons.OK);
         }
     }
     else
     {
         Select(found, text.Length);
         this.Focus();
         this.ScrollToCaret();
     }
 }
示例#4
0
 public void CopySpecial()
 {
     if (!Enabled)
         return;
     Selection oldSelection = new Selection(SelectionStart, SelectionLength);
     string copyThis = RtfConverter.Serialize(Rtf, SelectionStart,SelectionLength);
     Clipboard.SetDataObject(new DataObject(DataFormats.StringFormat, copyThis));
     Select(oldSelection);
 }