다음을 통해 공유


RichTextBox.BulletIndent 속성

글머리 기호 스타일이 텍스트에 적용될 때 RichTextBox 컨트롤에 사용된 들여쓰기를 가져오거나 설정합니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
<LocalizableAttribute(True)> _
Public Property BulletIndent As Integer
‘사용 방법
Dim instance As RichTextBox
Dim value As Integer

value = instance.BulletIndent

instance.BulletIndent = value
[LocalizableAttribute(true)] 
public int BulletIndent { get; set; }
[LocalizableAttribute(true)] 
public:
property int BulletIndent {
    int get ();
    void set (int value);
}
/** @property */
public int get_BulletIndent ()

/** @property */
public void set_BulletIndent (int value)
public function get BulletIndent () : int

public function set BulletIndent (value : int)

속성 값

글머리 기호 다음에 들여쓰기로 삽입된 픽셀의 수입니다. 기본값은 0입니다.

예외

예외 형식 조건

ArgumentException

지정된 들여쓰기가 0보다 작은 경우

설명

글머리 기호 스타일을 텍스트 단락에 적용하려면 SelectionBullet 속성을 true로 설정한 다음 텍스트를 들여쓸 픽셀의 수로 BulletIndent 속성을 설정합니다. 해당 단락의 글머리 기호 스타일에서 글머리 기호 다음에는 지정된 크기의 들여쓰기가 적용됩니다. 이 속성은 컨트롤 텍스트 내의 현재 단락과 글머리 항목 목록에서 현재 선택된 글머리 기호에만 영향을 줍니다. 글머리 항목의 전체 목록에 다른 들여쓰기 수준을 적용하려면 BulletIndent 속성을 설정하기 전에 글머리 항목의 모든 텍스트를 선택해야 합니다.

예제

다음 코드 예제에서는 SelectionBullet 속성을 BulletIndent, SelectionFont, SelectedTextSelectionColor 속성과 함께 사용하여 RichTextBox 컨트롤에 글머리 기호 목록을 만드는 방법을 보여 줍니다. 이 예제를 실행하려면 폼에 richTextBox1이라는 RichTextBox 컨트롤이 있어야 합니다.

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
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:
   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.set_BulletIndent(30);
    // Set the font for the opening text to a larger Arial font;
    richTextBox1.set_SelectionFont(new Font("Arial", 16));
    // Assign the introduction text to the RichTextBox control.
    richTextBox1.set_SelectedText("The following is a list of bulleted "
        + "items:\n");
    // Set the Font for the first item to a smaller size Arial font.
    richTextBox1.set_SelectionFont(new Font("Arial", 12));
    // Specify that the following items are to be added to a bulleted list.
    richTextBox1.set_SelectionBullet(true);
    // Set the color of the item text.
    richTextBox1.set_SelectionColor(Color.get_Red());
    // Assign the text to the bulleted item.
    richTextBox1.set_SelectedText("Apples" + "\n");
    // Apply same font since font settings do not carry to next line.
    richTextBox1.set_SelectionFont(new Font("Arial", 12));
    richTextBox1.set_SelectionColor(Color.get_Orange());
    richTextBox1.set_SelectedText("Oranges" + "\n");
    richTextBox1.set_SelectionFont(new Font("Arial", 12));
    richTextBox1.set_SelectionColor(Color.get_Purple());
    richTextBox1.set_SelectedText("Grapes" + "\n");
    // End the bulleted list.
    richTextBox1.set_SelectionBullet(false);
    // Specify the font size and string for text displayed below bulleted list.
    richTextBox1.set_SelectionFont(new Font("Verdana", 10));
    richTextBox1.set_SelectedText("The bulleted text is indented 30 pixels"
        + " from the bullet symbol using the BulletIndent property.\n");
} //WriteTextToRichTextBox

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

RichTextBox 클래스
RichTextBox 멤버
System.Windows.Forms 네임스페이스
SelectionBullet