RichTextBox.SelectionRightIndent Proprietà

Definizione

Distanza, espressa in pixel, tra il bordo destro del controllo RichTextBox e il bordo destro del testo selezionato o aggiunto in corrispondenza del punto di inserimento.

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

Valore della proprietà

Int32

Spazio di rientro, in pixel, a destra della selezione o del punto di inserimento corrente.

Attributi

Esempio

Nell'esempio di codice seguente viene illustrato come creare un margine destro in un RichTextBox utilizzando la SelectionRightIndent proprietà . L'esempio richiede che sia presente un modulo contenente un RichTextBox controllo denominato richTextBox1e che il codice di esempio venga chiamato da un evento all'interno della classe del modulo.

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

Commenti

Se non è attualmente selezionato alcun testo, l'impostazione del rientro viene applicata al paragrafo in cui viene visualizzato il punto di inserimento e a tutto il testo digitato nel controllo dopo il punto di inserimento. L'impostazione del rientro viene applicata fino a quando la proprietà non viene modificata in un valore diverso o fino a quando il punto di inserimento non viene spostato in un paragrafo diverso all'interno del controllo.

Se il testo viene selezionato all'interno del controllo, il testo selezionato e qualsiasi testo immesso dopo la selezione del testo avrà il valore di questa proprietà applicata. È possibile utilizzare questa proprietà per impostare il rientro dei paragrafi contenuti nel documento di RichTextBox. È possibile utilizzare questa proprietà insieme SelectionIndent a per creare paragrafi visualizzati nei paragrafi.

Per creare un rientro sporgente per i paragrafi nel controllo, utilizzare la SelectionHangingIndent proprietà .

Si applica a