Selection of RichTextBox in C#.NET
KetticRichTextBox control for Windows Forms is capable of selection for the users. It supports both user interface selection and the selection in C# code in .NET template projects. The user interface selection, or UI selection, allows the users to select the content of KetticRichTextBox in a similar way of Microsoft Word and the selection in C#, or selection programmatically, allows the developers perform the selection in their .NET projects.
UI Selection of KetticRichTextBox
The user interface selection of KetticRichTextBox resembles the selection of Microsoft Word. To perform the UI selection in KetticRichTextBox control, we can click on the start position and then drag to the end position desired to select the content. This control also supports multiple ranges selection, which can be achieved through pressing the Ctrl key while we select the contents of different ranges. C# Select Content of KetticRichTextBox
KetticRichTextBox control allows the developers to select the content in C#.NET template project. The programmatic selection will be applied to select the found string when there is a Find functionality in the KetticRichTextBox.
To implement the selection in C# code, we shall use the DocumentSelection C# class, whose instance is associated with the KetticDocument of KetticRichTextBox and allows the developers to assign the starts/ends, as well as ranges of the selection. KetticDocument contains the Selection property for the users to manipulate the selection. Alternatively, you can create an instance of the DocumentSelection C# class to customize the selection.
The C# code below shows how to select the current text in the document in .NET project.
Multiple Ranges Selection of KetticRichTextBox
KetticRichTextBox control provides the methods, AddSelectionStart() and AddSelectionEnd(), for the users to implement multiple ranges selection. Alternatively, it is also possible to select multiple ranges by using the Ranges collection of the KetticDocument. The following C# code sample demonstrates how to select the specific text, Kettic, in the content of document.
|
UI Controlsfor Windows Forms .NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI DesignWinForms UI Controls WinForms Buttons UI Control WinForms Calendar UI ControlWinForms Carousel UI ControlWinForms Chart UI ControlWinForms Clock UI ControlCommandBar UI ControlWinForms Dock UI ControlDesktop Alert UI ControlDropDown List UI ControlWinForms Editor UI ControlForms and Dialogs UI ControlWinForms GridView UI ControlWinForms ListView UI ControlWinForms Menu UI ControlWinForms ComboBox UI ControlWinForms PageView UI ControlPanels and Labels UI ControlWinForms Panorama UI ControlWinForms PDFViewer UI ControlWinForms Property Grid UI ControlWinForms Ribbon UI ControlWinForms PivotGrid UI ControlWinForms RichTextBox UI ControlGet Started in C#RichTextBox - SettingsDocument ElementsContentsSectionParagraphSpanHyperlinkInline ImageTableBookmarksRichTextBox - FeaturesLayout ModesSelectionSearchPositionRead OnlyFormat APIImport & ExportImport & Export - SettingsHTML SupportSpell CheckKeyboard SupportWinForms Rotator UI ControlWinForms Scheduler UI ControlWinForms Shortcuts UI ControlWinForms SpellChecker UI ControlWinForms Track & Status UI ControlWinForms TreeView UI ControlWinForms Wizard UI ControlWinForms Test UI ControlWinForms Theme UI Control |