Duplicates the current selection in the text box.
()
| 697 | /// Duplicates the current selection in the text box. |
| 698 | /// </summary> |
| 699 | public virtual void Duplicate() |
| 700 | { |
| 701 | if (IsReadOnly) |
| 702 | return; |
| 703 | |
| 704 | var selectedText = SelectedText; |
| 705 | if (selectedText.Length > 0) |
| 706 | { |
| 707 | var right = SelectionRight; |
| 708 | SetSelection(right); |
| 709 | Insert(selectedText); |
| 710 | SetSelection(right, right + selectedText.Length); |
| 711 | } |
| 712 | } |
| 713 | |
| 714 | /// <summary> |
| 715 | /// Ensures that the caret is visible in the TextBox window, by scrolling the TextBox control surface if necessary. |