Freigeben über


RichTextBox.SelectionHangingIndent Eigenschaft

Definition

Dient zum Abrufen oder Festlegen des Abstands zwischen dem linken Rand der ersten Textzeile im markierten Absatz und dem linken Rand der nachfolgenden Zeilen im selben Absatz.

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

Eigenschaftswert

Der Abstand in Pixel für den hängenden Einzug, der auf die aktuelle Textauswahl oder die Einfügemarke angewendet wird.

Attribute

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie hängende Einzuge innerhalb der RichTextBox Verwendung der SelectionHangingIndent Eigenschaft angegeben werden. Dieses Beispiel erfordert, dass dem Formular ein Steuerelement mit dem Namen hinzugefügt wurde.This example requires that a RichTextBox control, named richTextBox1, has been added to the form.

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

      // Specify a 20 pixel hanging indent in all paragraphs.
      richTextBox1->SelectionHangingIndent = 20;

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

      // Set the text within the control.
      richTextBox1->SelectedText = "This text contains a hanging indent. The first sentence of the paragraph is spaced normally.";
      richTextBox1->SelectedText = "All subsequent lines of text are indented based on the value of SelectionHangingIndent.";
      richTextBox1->SelectedText = "After this paragraph the indent is returned to normal spacing.\n";
      richTextBox1->SelectedText = "Since this is a new paragraph the indent is also applied to this paragraph.";
      richTextBox1->SelectedText = "All subsequent lines of text are indented based on the value of SelectionHangingIndent.";
   }
private void WriteIndentedTextToRichTextBox()
{
   // Clear all text from the RichTextBox;
   richTextBox1.Clear();
   // Specify a 20 pixel hanging indent in all paragraphs.
   richTextBox1.SelectionHangingIndent = 20;
   // Set the font for the text.
   richTextBox1.Font = new Font("Lucinda Console", 12);
   // Set the text within the control.
   richTextBox1.SelectedText = "This text contains a hanging indent. The first sentence of the paragraph is spaced normally.";
   richTextBox1.SelectedText = "All subsequent lines of text are indented based on the value of SelectionHangingIndent.";
   richTextBox1.SelectedText = "After this paragraph the indent is returned to normal spacing.\n";
   richTextBox1.SelectedText = "Since this is a new paragraph the indent is also applied to this paragraph.";
   richTextBox1.SelectedText = "All subsequent lines of text are indented based on the value of SelectionHangingIndent.";
}
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 hanging indent in all paragraphs.
   RichTextBox1.SelectionHangingIndent = 20
   ' Set the text within the control.
   RichTextBox1.SelectedText = "VBThis text contains a hanging indent. The first sentence of the paragraph is spaced normally."
   RichTextBox1.SelectedText = "All subsequent lines of text are indented based on the value of SelectionHangingIndent."
   RichTextBox1.SelectedText = "After this paragraph the indent is returned to normal spacing." + ControlChars.CrLf
   RichTextBox1.SelectedText = "Since this is a new paragraph the indent is also applied to this paragraph."
   RichTextBox1.SelectedText = "All subsequent lines of text are indented based on the value of SelectionHangingIndent."
End Sub

Hinweise

Wenn zurzeit kein Text markiert ist, wird der hängende Einzug auf den Absatz angewendet, in dem die Einfügemarke angezeigt wird, und auf allen Text, der nach der Einfügemarke in das Steuerelement eingegeben wird. Die Einstellung für hängenden Einzug 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. Mit dieser Eigenschaft können Sie einen hängenden Einzug auf Ihre Absätze anwenden.

Verwenden Sie die SelectionIndent Eigenschaft, um den Einzug der ersten Zeile einer Absatzauswahl festzulegen.

Gilt für:

Weitere Informationen