RichTextBox.BulletIndent Vlastnost

Definice

Získá nebo nastaví odsazení použité v ovládacím RichTextBox prvku při použití stylu odrážek na text.

public:
 property int BulletIndent { int get(); void set(int value); };
public int BulletIndent { get; set; }
member this.BulletIndent : int with get, set
Public Property BulletIndent As Integer

Hodnota vlastnosti

Int32

Počet pixelů vložených jako odsazení za odrážku Výchozí hodnota je nula.

Výjimky

Zadaná odsazení byla menší než nula.

Příklady

Následující příklad kódu ukazuje, jak použít SelectionBullet vlastnost s BulletIndent, , SelectedTextSelectionFonta SelectionColor vlastnosti k vytvoření seznamu s odrážkami v ovládacím RichTextBox prvku. Tento příklad vyžaduje vytvoření RichTextBox ovládacího prvku pojmenovaného richTextBox1 ve formuláři.

private:
   void WriteTextToRichTextBox()
   {
      // Clear all text from the RichTextBox;
      richTextBox1->Clear();

      // Indent bulleted text 30 pixels away from the bullet.
      richTextBox1->BulletIndent = 30;

      // Set the font for the opening text to a larger Arial font;
      richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",16 );

      // Assign the introduction text to the RichTextBox control.
      richTextBox1->SelectedText = "The following is a list of bulleted items:\n";

      // Set the Font for the first item to a smaller size Arial font.
      richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 );

      // Specify that the following items are to be added to a bulleted list.
      richTextBox1->SelectionBullet = true;

      // Set the color of the item text.
      richTextBox1->SelectionColor = Color::Red;

      // Assign the text to the bulleted item.
      richTextBox1->SelectedText = "Apples"
      "\n";

      // Apply same font since font settings do not carry to next line.
      richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 );
      richTextBox1->SelectionColor = Color::Orange;
      richTextBox1->SelectedText = "Oranges"
      "\n";
      richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 );
      richTextBox1->SelectionColor = Color::Purple;
      richTextBox1->SelectedText = "Grapes"
      "\n";

      // End the bulleted list.
      richTextBox1->SelectionBullet = false;

      // Specify the font size and string for text displayed below bulleted list.
      richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Verdana",10 );
      richTextBox1->SelectedText = "The bulleted text is indented 30 pixels from the bullet symbol using the BulletIndent property.\n";
   }
private void WriteTextToRichTextBox()
{
   // Clear all text from the RichTextBox;
   richTextBox1.Clear();
   // Indent bulleted text 30 pixels away from the bullet.
   richTextBox1.BulletIndent = 30;
   // Set the font for the opening text to a larger Arial font;
   richTextBox1.SelectionFont = new Font("Arial", 16);
   // Assign the introduction text to the RichTextBox control.
   richTextBox1.SelectedText = "The following is a list of bulleted items:\n";
   // Set the Font for the first item to a smaller size Arial font.
   richTextBox1.SelectionFont = new Font("Arial", 12);
   // Specify that the following items are to be added to a bulleted list.
   richTextBox1.SelectionBullet = true;
   // Set the color of the item text.
   richTextBox1.SelectionColor = Color.Red;
   // Assign the text to the bulleted item.
   richTextBox1.SelectedText = "Apples" + "\n";
   // Apply same font since font settings do not carry to next line.
   richTextBox1.SelectionFont = new Font("Arial", 12);
   richTextBox1.SelectionColor = Color.Orange;
   richTextBox1.SelectedText = "Oranges" + "\n";
   richTextBox1.SelectionFont = new Font("Arial", 12);
   richTextBox1.SelectionColor = Color.Purple;
   richTextBox1.SelectedText = "Grapes" + "\n";
   // End the bulleted list.
   richTextBox1.SelectionBullet = false;
   // Specify the font size and string for text displayed below bulleted list.
   richTextBox1.SelectionFont = new Font("Verdana", 10);
   richTextBox1.SelectedText = "The bulleted text is indented 30 pixels from the bullet symbol using the BulletIndent property.\n";
}
Private Sub WriteTextToRichTextBox()
   ' Clear all text from the RichTextBox;
   richTextBox1.Clear()
   ' Indent bulleted text 30 pixels away from the bullet.
   richTextBox1.BulletIndent = 30
   ' Set the font for the opening text to a larger Arial font;
   richTextBox1.SelectionFont = New Font("Arial", 16)
   ' Assign the introduction text to the RichTextBox control.
   RichTextBox1.SelectedText = "The following is a list of bulleted items:" + ControlChars.Cr
   ' Set the Font for the first item to a smaller size Arial font.
   richTextBox1.SelectionFont = New Font("Arial", 12)
   ' Specify that the following items are to be added to a bulleted list.
   richTextBox1.SelectionBullet = True
   ' Set the color of the item text.
   richTextBox1.SelectionColor = Color.Red
   ' Assign the text to the bulleted item.
   richTextBox1.SelectedText = "Apples" + ControlChars.Cr
   ' Apply same font since font settings do not carry to next line.
   richTextBox1.SelectionFont = New Font("Arial", 12)
   richTextBox1.SelectionColor = Color.Orange
   richTextBox1.SelectedText = "Oranges" + ControlChars.Cr
   richTextBox1.SelectionFont = New Font("Arial", 12)
   richTextBox1.SelectionColor = Color.Purple
   richTextBox1.SelectedText = "Grapes" + ControlChars.Cr
   ' End the bulleted list.
   richTextBox1.SelectionBullet = False
   ' Specify the font size and string for text displayed below bulleted list.
   richTextBox1.SelectionFont = New Font("Verdana", 10)
   richTextBox1.SelectedText = "The bulleted text is indented 30 pixels from the bullet symbol using the BulletIndent property." + ControlChars.Cr
End Sub

Poznámky

Chcete-li použít styl odrážek na odstavec textu, nastavte vlastnost na true a potom nastavte BulletIndent SelectionBullet vlastnost na počet pixelů, které má být text odsazený. Odstavec bude mít použitý styl odrážek se zadaným množstvím odsazení za odrážkou. Tato vlastnost má vliv pouze na aktuální odstavec v textu ovládacího prvku a aktuálně vybrané odrážky v seznamu položek s odrážkami. Chcete-li použít jinou úroveň odsazení na celý seznam položek s odrážkami, musí být před nastavením BulletIndent vlastnosti vybrán veškerý text položek s odrážkami.

Platí pro

Viz také