RichTextBox.SelectionRightIndent Propriedade

Definição

A distância (em pixels) entre a borda direita do RichTextBox controlo e a borda direita do texto que é selecionada ou adicionada no ponto de inserção atual.

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

Valor de Propriedade

O espaço de indentação, em pixels, à direita do ponto de seleção ou inserção atual.

Atributos

Exemplos

O exemplo de código seguinte demonstra como criar uma margem direita em um RichTextBox usando a SelectionRightIndent propriedade. O exemplo exige que tenhas um formulário que contenha um RichTextBox controlo chamado richTextBox1, e que o código de exemplo seja chamado a partir de um evento dentro da classe do formulário.

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

Observações

Se não houver texto selecionado, a definição de indentação é aplicada ao parágrafo onde aparece o ponto de inserção e a todo o texto que é digitado no controlo após o ponto de inserção. A definição de indentação aplica-se até que a propriedade seja alterada para um valor diferente ou até que o ponto de inserção seja movido para um parágrafo diferente dentro do controlo.

Se o texto for selecionado dentro do controlo, o texto selecionado e qualquer texto inserido após a seleção do texto terão o valor desta propriedade aplicado. Pode usar esta propriedade para indentar parágrafos contidos no documento do RichTextBox. Pode usar esta propriedade em conjunto SelectionIndent com para criar parágrafos apresentados em parágrafos.

Para criar uma reentrância pendente para parágrafos no controlo, use a SelectionHangingIndent propriedade.

Aplica-se a