RichTextBox.SelectionRightIndent Właściwość

Definicja

Odległość (w pikselach) między prawą krawędzią kontrolki RichTextBox a prawą krawędzią tekstu zaznaczonego lub dodanego w bieżącym punkcie wstawiania.

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

Wartość właściwości

Miejsce wcięcia w pikselach po prawej stronie bieżącego zaznaczenia lub punktu wstawiania.

Atrybuty

Przykłady

W poniższym przykładzie kodu pokazano, jak utworzyć prawy margines przy RichTextBox użyciu SelectionRightIndent właściwości . Przykład wymaga formularza zawierającego kontrolkę RichTextBox o nazwie richTextBox1, a przykładowy kod jest wywoływany ze zdarzenia w klasie formularza.

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

Uwagi

Jeśli tekst nie jest aktualnie zaznaczony, ustawienie wcięcia jest stosowane do akapitu, w którym pojawia się punkt wstawiania i do całego tekstu wpisanego w kontrolce po punkcie wstawiania. Ustawienie wcięcia ma zastosowanie do momentu zmiany właściwości na inną wartość lub do momentu przeniesienia punktu wstawiania do innego akapitu w kontrolce.

Jeśli tekst jest zaznaczony w kontrolce, zaznaczony tekst i dowolny tekst wprowadzony po zaznaczeniu tekstu będą miały do niego zastosowaną wartość tej właściwości. Tej właściwości można użyć do wcięcia akapitów zawartych w dokumencie .RichTextBox Tej właściwości można używać w połączeniu z elementem SelectionIndent , aby utworzyć akapity wyświetlane w akapitach.

Aby utworzyć wcięcie zawieszające się dla akapitów w kontrolce, użyj SelectionHangingIndent właściwości .

Dotyczy