RichTextBox.SelectionRightIndent Propriedade
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
A distância (em pixels) entre a borda direita do RichTextBox controle e a borda direita do texto selecionado ou adicionado 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 da propriedade
O espaço de recuo, em pixels, à direita do ponto de seleção ou inserção atual.
- Atributos
Exemplos
O exemplo de código a seguir demonstra como criar uma margem direita em uma RichTextBox propriedade usando a SelectionRightIndent propriedade. O exemplo requer que você tenha um formulário que contenha um RichTextBox controle nomeado richTextBox1e que o código de exemplo seja chamado 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
Comentários
Se nenhum texto estiver selecionado no momento, a configuração de recuo será aplicada ao parágrafo no qual o ponto de inserção é exibido e a todo o texto digitado no controle após o ponto de inserção. A configuração de recuo se aplica 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 controle.
Se o texto for selecionado dentro do controle, o texto selecionado e qualquer texto inserido após a seleção de texto terão o valor dessa propriedade aplicado a ele. Você pode usar essa propriedade para recuar parágrafos contidos no documento do RichTextBox. Você pode usar essa propriedade em conjunto com os SelectionIndent parágrafos para criar exibidos em parágrafos.
Para criar um recuo deslocado para parágrafos no controle, use a SelectionHangingIndent propriedade.