RichTextBox.SelectionHangingIndent Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém ou define a distância entre a extremidade esquerda da primeira linha de texto no parágrafo selecionado e a extremidade esquerda das linhas seguintes no mesmo parágrafo.
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
Valor de Propriedade
A distância, em píxeis, para o recuo pendente aplicada à seleção de texto atual ou ao ponto de inserção.
- Atributos
Exemplos
O exemplo de código seguinte demonstra como especificar recuos suspensos dentro do RichTextBox usando a SelectionHangingIndent propriedade. Este exemplo exige que um RichTextBox controlo, chamado richTextBox1, tenha sido adicionado ao formulário.
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
Observações
Se não for selecionado texto, o recuo suspenso é aplicado 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 recuo suspenso 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 aplicar um recuo pendente aos seus parágrafos.
Para definir a reentrância da primeira linha de uma seleção de parágrafo, use a SelectionIndent propriedade.