Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Ruft einen Wert ab, der angibt, ob der Aufzählungssymbolstil auf die aktuelle Auswahl oder Einfügemarke angewendet wird, oder legt diesen fest.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Property SelectionBullet As Boolean
'Usage
Dim instance As RichTextBox
Dim value As Boolean
value = instance.SelectionBullet
instance.SelectionBullet = value
public bool SelectionBullet { get; set; }
public:
property bool SelectionBullet {
bool get ();
void set (bool value);
}
/** @property */
public boolean get_SelectionBullet ()
/** @property */
public void set_SelectionBullet (boolean value)
public function get SelectionBullet () : boolean
public function set SelectionBullet (value : boolean)
Eigenschaftenwert
true, wenn der Aufzählungssymbolstil auf die aktuelle Auswahl oder Einfügemarke angewendet wird, andernfalls false.
Hinweise
Wenn kein Text markiert ist, wird der Aufzählungssymbolstil auf die aktuelle Einfügemarke und alle danach eingegebenen Absätze angewendet. Der Aufzählungssymbolstil wird auf den Text des Steuerelements angewendet, bis die Einfügemarke verschoben oder die EINGABETASTE für ein leeres Aufzählungselement gedrückt wird.
Wenn bei festgelegter Eigenschaft Text im Steuerelement markiert wird, werden alle Absätze innerhalb des markierten Texts in Aufzählungselemente einer Aufzählung konvertiert. Mit dieser Eigenschaft können Sie Aufzählungen in den Dokumenten erstellen, die Sie im RichTextBox-Steuerelement erstellen.
Mit der BulletIndent-Eigenschaft können Sie die Größe des Einzugs zwischen Aufzählungszeichen und dem Text des Aufzählungselements angeben.
Beispiel
Im folgenden Codebeispiel wird veranschaulicht, wie die SelectionBullet-Eigenschaft mit den Eigenschaften SelectionFont, SelectedText und SelectionColor zum Erstellen einer Aufzählung in einem RichTextBox-Steuerelement verwendet wird. Für dieses Beispiel ist es erforderlich, dass ein RichTextBox-Steuerelement mit dem Namen richTextBox1 in einem Formular erstellt wurde.
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
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:
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.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("Arial", 16));
richTextBox1.set_SelectedText("Bulleted Text Complete!");
} //WriteTextToRichTextBox
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
RichTextBox-Klasse
RichTextBox-Member
System.Windows.Forms-Namespace
RichTextBox.BulletIndent-Eigenschaft