Sdílet prostřednictvím


RichTextBox.SelectionRightIndent Vlastnost

Definice

Vzdálenost (v pixelech) mezi pravým okrajem RichTextBox ovládacího prvku a pravým okrajem textu, který je vybraný nebo přidaný na aktuální pozici kurzoru.

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

Hodnota vlastnosti

Odsazení mezery v pixelech napravo od aktuálního výběru nebo kurzoru.

Atributy

Příklady

Následující příklad kódu ukazuje, jak vytvořit pravý okraj v RichTextBox použití SelectionRightIndent vlastnosti. Příklad vyžaduje, abyste měli formulář, který obsahuje RichTextBox ovládací prvek s názvem richTextBox1, a že ukázkový kód je volána z události v rámci třídy formuláře.

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

Poznámky

Pokud není aktuálně vybrán žádný text, použije se nastavení odsazení u odstavce, ve kterém se kurzor zobrazí, a pro veškerý text zadaný do ovládacího prvku za kurzorem. Nastavení odsazení platí, dokud se vlastnost nezmění na jinou hodnotu nebo dokud se kurzor nepřesune do jiného odstavce v ovládacím prvku.

Pokud je text vybrán v ovládacím prvku, bude mít vybraný text a jakýkoli text zadaný po výběru textu hodnotu této vlastnosti. Tuto vlastnost můžete použít k odsazení odstavců obsažených RichTextBoxv dokumentu . Tuto vlastnost můžete použít ve spojení s SelectionIndent vytvořením odstavců zobrazených v odstavcích.

Chcete-li vytvořit předsazení odstavců v ovládacím prvku, použijte SelectionHangingIndent vlastnost.

Platí pro