Freigeben über


RichTextBox.SelectionRightIndent Eigenschaft

Definition

Der Abstand (in Pixel) zwischen dem rechten Rand des RichTextBox Steuerelements und dem rechten Rand des Texts, der an der aktuellen Einfügemarke markiert oder hinzugefügt wird.

public:
 property int SelectionRightIndent { int get(); void set(int value); };
[System.ComponentModel.Browsable(false)]
public int SelectionRightIndent { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.SelectionRightIndent : int with get, set
Public Property SelectionRightIndent As Integer

Eigenschaftswert

Der Einzugsbereich in Pixel rechts neben der aktuellen Markierung oder Einfügemarke.

Attribute

Beispiele

Im folgenden Codebeispiel wird das Erstellen eines rechten Rands in einer RichTextBox Using-Eigenschaft SelectionRightIndent veranschaulicht. Das Beispiel erfordert, dass Sie über ein Formular verfügen, das ein Steuerelement mit dem RichTextBox Namen richTextBox1enthält, und dass der Beispielcode aus einem Ereignis innerhalb der Formularklasse aufgerufen wird.

private:
   void WriteIndentedTextToRichTextBox()
   {
      // Clear all text from the RichTextBox;
      richTextBox1->Clear();

      // Specify a 20 pixel right indent in all paragraphs.
      richTextBox1->SelectionRightIndent = 20;

      // Set the font for the text.
      richTextBox1->Font = gcnew System::Drawing::Font( "Lucinda Console",12 );

      // Set the text within the control.
      richTextBox1->SelectedText = "All text is indented 20 pixels from the right edge of the RichTextBox.";
      richTextBox1->SelectedText = "You can use this property with the SelectionIndent property to provide right and left margins.";
      richTextBox1->SelectedText = "After this paragraph the indentation will end.\n\n";

      // Remove all right indentation.
      richTextBox1->SelectionRightIndent = 0;
      richTextBox1->SelectedText = "This paragraph has no right indentation. All text should flow as normal.";
   }
private void WriteIndentedTextToRichTextBox()
{
    // Clear all text from the RichTextBox;
    richTextBox1.Clear();
    // Specify a 20 pixel right indent in all paragraphs.
    richTextBox1.SelectionRightIndent = 20;
    // Set the font for the text.
    richTextBox1.Font = new Font("Lucinda Console", 12);
    // Set the text within the control.
    richTextBox1.SelectedText = "All text is indented 20 pixels from the right edge of the RichTextBox.";
    richTextBox1.SelectedText = "You can use this property with the SelectionIndent property to provide right and left margins.";
    richTextBox1.SelectedText = "After this paragraph the indentation will end.\n\n";
    // Remove all right indentation.
    richTextBox1.SelectionRightIndent = 0;
    richTextBox1.SelectedText = "This paragraph has no right indentation. All text should flow as normal.";
}
Private Sub WriteIndentedTextToRichTextBox()
   ' Clear all text from the RichTextBox;
   RichTextBox1.Clear()
   ' Set the font for the text.
   RichTextBox1.Font = New Font("Lucinda Console", 12)
   ' Specify a 20 pixel right indent in all paragraphs.
   RichTextBox1.SelectionRightIndent = 20
   ' Set the text within the control.
   RichTextBox1.SelectedText = "All text is indented 20 pixels from the right edge of the RichTextBox."
   RichTextBox1.SelectedText = "You can use this property with the SelectionIndent property to provide right and left margins."
   RichTextBox1.SelectedText = "After this paragraph the indentation will end." + ControlChars.CrLf
   ' Remove all right indentation.
   RichTextBox1.SelectionRightIndent = 0
   RichTextBox1.SelectedText = "This paragraph has no right indentation. All text should flow as normal."
End Sub

Hinweise

Wenn zurzeit kein Text markiert ist, wird die Einzugseinstellung auf den Absatz angewendet, in dem die Einfügemarke angezeigt wird, und auf den gesamten Text, der nach der Einfügemarke in das Steuerelement eingegeben wird. Die Einzugseinstellung gilt, bis die Eigenschaft in einen anderen Wert geändert wird oder bis die Einfügemarke in einen anderen Absatz innerhalb des Steuerelements verschoben wird.

Wenn Text innerhalb des Steuerelements markiert ist, wird der markierte Text und jeder Text, der nach der Textauswahl eingegeben wurde, den Wert dieser Eigenschaft zugewiesen. Sie können diese Eigenschaft verwenden, um Absätze einzurücken, die im Dokument des Dokuments RichTextBoxenthalten sind. Sie können diese Eigenschaft in Verbindung mit den SelectionIndent Absätzen verwenden, um Absätze zu erstellen.

Verwenden Sie die SelectionHangingIndent Eigenschaft, um einen hängenden Einzug für Absätze im Steuerelement zu erstellen.

Gilt für: