RichTextBox.SelectionHangingIndent Eigenschap

Definitie

Hiermee haalt u de afstand op tussen de linkerrand van de eerste tekstregel in de geselecteerde alinea en de linkerrand van de volgende regels in dezelfde alinea.

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

Waarde van eigenschap

De afstand, in pixels, voor de verkeerd-om inspringing die is toegepast op de huidige tekstselectie of de invoegpositie.

Kenmerken

Voorbeelden

In het volgende codevoorbeeld ziet u hoe u verkeerd-om inspringingen in de RichTextBoxSelectionHangingIndent eigenschap opgeeft. In dit voorbeeld moet een RichTextBox besturingselement met de naam richTextBox1zijn toegevoegd aan het formulier.

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

Opmerkingen

Als er momenteel geen tekst is geselecteerd, wordt de verkeerd-om inspringing toegepast op de alinea waarin de invoegpositie wordt weergegeven en op alle tekst die na de invoegpositie in het besturingselement is getypt. De instelling voor verkeerd-om inspringing is van toepassing totdat de eigenschap wordt gewijzigd in een andere waarde of totdat de invoegpositie wordt verplaatst naar een andere alinea in het besturingselement.

Als tekst in het besturingselement is geselecteerd, worden de geselecteerde tekst en alle tekst die na de tekstselectie is ingevoerd, de waarde van deze eigenschap toegepast. U kunt deze eigenschap gebruiken om een verkeerd-om inspringing toe te passen op alinea's.

Als u de inspringing van de eerste regel van een alineaselectie wilt instellen, gebruikt u de SelectionIndent eigenschap.

Van toepassing op

Zie ook