RichTextBox.SelectionBullet 속성

정의

현재 선택 영역 또는 삽입 지점에 글머리 기호 스타일이 적용되어 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool SelectionBullet { bool get(); void set(bool value); };
[System.ComponentModel.Browsable(false)]
public bool SelectionBullet { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.SelectionBullet : bool with get, set
Public Property SelectionBullet As Boolean

속성 값

Boolean

현재 선택 영역 또는 삽입 지점에 적용된 글머리 기호 스타일이 있으면 true이고, 그렇지 않으면 false입니다.

특성

예제

다음 코드 예제에서는 컨트롤SelectedTextSelectionFont에서 SelectionBullet 글머리 기호 목록을 RichTextBox 만드는 속성 및 SelectionColor 속성을 사용 하는 방법을 보여 줍니다. 이 예제에서는 폼에 명명 richTextBox1RichTextBox 컨트롤을 만들어야 합니다.

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

      // 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( "Arial",16 );
      richTextBox1->SelectedText = "Bulleted Text Complete!";
   }
private void WriteTextToRichTextBox()
{
   // Clear all text from the RichTextBox;
   richTextBox1.Clear();
   // 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("Arial", 16);
   richTextBox1.SelectedText = "Bulleted Text Complete!";
}
Private Sub WriteTextToRichTextBox()
   ' Clear all text from the RichTextBox;
   richTextBox1.Clear()
   ' 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("Arial", 16)
   richTextBox1.SelectedText = "Bulleted Text Complete!"
End Sub

설명

텍스트를 선택하지 않으면 글머리 기호 스타일이 현재 삽입 지점 및 사용자가 삽입 지점 뒤에 입력하는 모든 단락에 적용됩니다. 글머리 기호 스타일은 삽입 지점이 이동되거나 사용자가 빈 글머리 기호 항목의 Enter 키를 누를 때까지 컨트롤의 텍스트에 적용됩니다.

이 속성을 설정할 때 컨트롤 내에서 텍스트를 선택하면 선택한 텍스트 내의 모든 단락이 글머리 기호 목록의 글머리 기호 항목으로 변환됩니다. 이 속성을 사용하여 컨트롤에서 RichTextBox 만든 문서 내에 글머리 기호 목록을 만들 수 있습니다.

BulletIndent 속성을 사용하면 글머리 기호와 글머리 기호 항목의 텍스트 사이에 적용할 들여쓰기 양을 지정할 수 있습니다.

적용 대상

추가 정보