RichTextBox.SelectionIndent Vlastnost
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Získá nebo nastaví délku odsazení řádku, kde výběr začíná.
public:
property int SelectionIndent { int get(); void set(int value); };
[System.ComponentModel.Browsable(false)]
public int SelectionIndent { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.SelectionIndent : int with get, set
Public Property SelectionIndent As Integer
Hodnota vlastnosti
Aktuální vzdálenost v pixelech odsazení použitého nalevo od aktuálního výběru textu nebo kurzoru.
- Atributy
Příklady
Následující příklad kódu ukazuje, jak zadat odsazený text v rámci RichTextBox použití SelectionIndent vlastnosti. Tento příklad vyžaduje, aby RichTextBox byl do formuláře přidán ovládací prvek s názvem richTextBox1.
private:
void WriteIndentedTextToRichTextBox()
{
// Clear all text from the RichTextBox;
richTextBox1->Clear();
// Specify a 20 pixel indent in all paragraphs.
richTextBox1->SelectionIndent = 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 left edge of the RichTextBox.";
richTextBox1->SelectedText = "You can use this property to provide proper indentation such as when writing a letter.";
richTextBox1->SelectedText = "After this paragraph the indent is returned to normal spacing.\n\n";
richTextBox1->SelectionIndent = 0;
richTextBox1->SelectedText = "No indenation is applied to this paragraph. All text in the paragraph flows from each control edge.";
}
private void WriteIndentedTextToRichTextBox()
{
// Clear all text from the RichTextBox;
richTextBox1.Clear();
// Specify a 20 pixel indent in all paragraphs.
richTextBox1.SelectionIndent = 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 left edge of the RichTextBox.";
richTextBox1.SelectedText = "You can use this property to provide proper indentation such as when writing a letter.";
richTextBox1.SelectedText = "After this paragraph the indent is returned to normal spacing.\n\n";
richTextBox1.SelectionIndent = 0;
richTextBox1.SelectedText = "No indenation is applied to this paragraph. All text in the paragraph flows from each control edge.";
}
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 indent in all paragraphs.
RichTextBox1.SelectionIndent = 20
' Set the text within the control.
RichTextBox1.SelectedText = "All text is indented 20 pixels from the left edge of the RichTextBox."
RichTextBox1.SelectedText = "You can use this property to provide proper indentation such as when writing a letter."
RichTextBox1.SelectedText = "After this paragraph the indent is returned to normal spacing." + ControlChars.Crlf
RichTextBox1.SelectionIndent = 0
RichTextBox1.SelectedText = "No indenation is applied to this paragraph. All text in the paragraph flows from each control edge."
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 SelectionRightIndent 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.