RichTextBox.SelectionRightIndent Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

The distance (in pixels) between the right edge of the RichTextBox control and the right edge of the text that is selected or added at the current insertion point.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member SelectionRightIndent : int with get, set

Property Value

Type: System.Int32

The indentation space, in pixels, at the right of the current selection or insertion point.

If no text is currently selected, the indentation setting is applied to the paragraph in which the insertion point appears and to all text that is typed into the control after the insertion point. The indentation setting applies until the property is changed to a different value or until the insertion point is moved to a different paragraph within the control.

If text is selected within the control, the selected text and any text entered after the text selection will have the value of this property applied to it. You can use this property to indent paragraphs contained in document of the RichTextBox. You can use this property in conjunction with the SelectionIndent to create paragraphs displayed in paragraphs.

To create a hanging indent for paragraphs in the control, use the SelectionHangingIndent property.

The following code example demonstrates how to create a right margin in a RichTextBox using the SelectionRightIndent property. The example requires that you have a form that contains a RichTextBox control named richTextBox1, and that the example code is called from an event within the form's class.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top