windowsforms-119803-controls-and-libraries-rich-text-editor-examples-text-how-to-mark-text-as-hidden-and-display-hidden-text-in-the-rich-edit-control.md
The following example describes how to mark text as hidden and display hidden text in the RichEditControl.
Use the Range property to get the range occupied by the target text.
Call the SubDocument.BeginUpdateCharacters method to update the character properties. Pass the retrieved range to the method as a range parameter.
Set the CharacterPropertiesBase.Hidden property to true to hide the text.
Call the SubDocument.EndUpdateCharacters method to finalize the update.
The code sample below hides the third document paragraph.
DocumentRange hiddenRange = richEditControl1.Document.Paragraphs[2].Range;
CharacterProperties hiddenTextProperties = richEditControl1.Document.BeginUpdateCharacters(hiddenRange);
hiddenTextProperties.Hidden = true;
richEditControl1.Document.EndUpdateCharacters(hiddenTextProperties);
Dim hiddenRange As DocumentRange = richEditControl1.Document.Paragraphs(2).Range
Dim hiddenTextProperties As CharacterProperties = richEditControl1.Document.BeginUpdateCharacters(hiddenRange)
hiddenTextProperties.Hidden = True
richEditControl1.Document.EndUpdateCharacters(hiddenTextProperties)
Set the FormattingMarkVisibilityOptions.HiddenText property to RichEditFormattingMarkVisibility.Visible to display hidden text in the RichEditControl. Access the property using the richEditControl.Options.FormattingMarkVisibility notation.
richEditControl1.Options.FormattingMarkVisibility.HiddenText = RichEditFormattingMarkVisibility.Visible;
richEditControl1.Options.FormattingMarkVisibility.HiddenText = RichEditFormattingMarkVisibility.Visible
The image below illustrates how the RichEditControl displays hidden text.