Пример #1
0
 private void SelectCurrentWord(DocumentPosition position)
 {
     position.MoveToCurrentWordStart();
     this.Document.Selection.SetSelectionStart(position);
     position.MoveToCurrentWordEnd();
     this.Document.Selection.AddSelectionEnd(position);
 }
Пример #2
0
        private void CreateShowDocument()
        {
            var document = new RadDocument();
            document.LayoutMode = DocumentLayoutMode.Paged;

            RadDocumentEditor editor = new RadDocumentEditor(document);
            editor.Insert("Text Before Text Inside Text After");

            DocumentPosition rangeStartPosition = new DocumentPosition(document);
            rangeStartPosition.MoveToNextWordStart();
            rangeStartPosition.MoveToNextWordStart();

            DocumentPosition rangeEndPosition = new DocumentPosition(rangeStartPosition);
            rangeEndPosition.MoveToNextWordStart();
            rangeEndPosition.MoveToCurrentWordEnd();

            document.Selection.SetSelectionStart(rangeStartPosition);
            document.Selection.AddSelectionEnd(rangeEndPosition);

            editor.InsertAnnotationRange(new CustomRangeStart(), new CustomRangeEnd());

            this.radRichTextBox.Document = document;

            UpdateTextBoxText();
        }
Пример #3
0
        private void CreateShowDocument()
        {
            var document = new RadDocument();

            document.LayoutMode = DocumentLayoutMode.Paged;

            RadDocumentEditor editor = new RadDocumentEditor(document);

            editor.Insert("Text Before Text Inside Text After");

            DocumentPosition rangeStartPosition = new DocumentPosition(document);

            rangeStartPosition.MoveToNextWordStart();
            rangeStartPosition.MoveToNextWordStart();

            DocumentPosition rangeEndPosition = new DocumentPosition(rangeStartPosition);

            rangeEndPosition.MoveToNextWordStart();
            rangeEndPosition.MoveToCurrentWordEnd();

            document.Selection.SetSelectionStart(rangeStartPosition);
            document.Selection.AddSelectionEnd(rangeEndPosition);

            editor.InsertAnnotationRange(new CustomRangeStart(), new CustomRangeEnd());

            this.radRichTextBox.Document = document;

            UpdateTextBoxText();
        }
Пример #4
0
        private void ReplaceCurrentWord(SpanLayoutBox spanBox, string newWord)
        {
            this.Document.CaretPosition.MoveToInline(spanBox, 0);

            DocumentPosition endPosition = new DocumentPosition(this.Document.CaretPosition);

            endPosition.MoveToCurrentWordEnd();

            this.Document.Selection.Clear();
            this.Document.Selection.AddSelectionStart(this.Document.CaretPosition);
            this.Document.Selection.AddSelectionEnd(endPosition);

            this.Insert(newWord);
        }
Пример #5
0
 private bool checkScript()
 {
     if (txtSourceSQL.Text.ToLower().Contains("drop"))
     {
         DocumentPosition position = new DocumentPosition(this.txtSourceSQL.Document);
         do
         {
             string word = position.GetCurrentSpanBox().Text;
             if (word.ToLower() == "drop")
             {
                 DocumentPosition wordEndPosition = new DocumentPosition(position);
                 wordEndPosition.MoveToCurrentWordEnd();
                 txtSourceSQL.Document.Selection.AddSelectionStart(position);
                 txtSourceSQL.Document.Selection.AddSelectionEnd(wordEndPosition);
             }
         }while (position.MoveToNextWordStart());
         return(true);
     }
     else
     {
         return(false);
     }
 }
        private string GetCurrentWord()
        {
            DocumentPosition pos = new DocumentPosition(this.Document.CaretPosition);
            pos.MoveToCurrentWordStart();

            DocumentSelection selection = new DocumentSelection(this.Document);
            selection.AddSelectionStart(pos);

            pos.MoveToCurrentWordEnd();
            selection.AddSelectionEnd(pos);

            return selection.GetSelectedText().Trim();
        }