windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-ab0897f4.md
Removes the selection from the document, and places it on the Clipboard.
Namespace : DevExpress.XtraRichEdit
Assembly : DevExpress.XtraRichEdit.v25.2.dll
NuGet Package : DevExpress.Win.RichEdit
public void Cut()
Public Sub Cut
The following code finds all occurrences of the “Custom Action” phrase using the SubDocument.FindAll method, selects and cuts them.
The RichEditControl instance is passed to the BarItem.ItemClick event handler using the BarItem.Tag property.
static void buttonCustomAction_ItemClick_Cut(object sender, ItemClickEventArgs e) {
RichEditControl richEdit = e.Item.Tag as RichEditControl;
DocumentRange[] foundRanges = richEdit.Document.FindAll("Custom Action", SearchOptions.None);
for(int i = 0; i < foundRanges.Length; i++) {
richEdit.Document.Selection = foundRanges[i];
richEdit.Cut();
}
}
Private Shared Sub buttonCustomAction_ItemClick_Cut(ByVal sender As Object, ByVal e As ItemClickEventArgs)
Dim richEdit As RichEditControl = TryCast(e.Item.Tag, RichEditControl)
Dim foundedRanges() As DocumentRange = richEdit.Document.FindAll("Custom Action", SearchOptions.None)
For i As Integer = 0 To foundedRanges.Length - 1
richEdit.Document.Selection = foundedRanges(i)
richEdit.Cut()
Next i
End Sub
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Cut() method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L459
richEdit.Document.Selection = foundRanges[i];
richEdit.Cut();
}
winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L467
richEdit.Document.Selection = foundedRanges(i)
richEdit.Cut()
Next i
See Also