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 den Einzug ab, der im RichTextBox-Steuerelement verwendet wird, wenn der Aufzählungssymbolstil auf den Text angewendet wird, oder legt diesen fest.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
<LocalizableAttribute(True)> _
Public Property BulletIndent As Integer
'Usage
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)
Eigenschaftenwert
Die Anzahl der Pixel, die nach einem Aufzählungszeichen als Einzug eingefügt werden. Der Standardwert ist 0 (null).
Ausnahmen
| Ausnahmetyp | Bedingung |
|---|---|
Der angegebene Einzug ist kleiner als 0 (null). |
Hinweise
Um den Aufzählungssymbolstil auf einen Textabsatz anzuwenden, legen Sie die SelectionBullet-Eigenschaft auf true und dann die BulletIndent-Eigenschaft auf die Anzahl der Pixel fest, um die der Text eingezogen werden soll. Der Aufzählungssymbolstil wird mit dem angegebenen Einzug nach dem Aufzählungszeichen auf den Absatz angewendet. Diese Eigenschaft wirkt sich nur auf den aktuellen Absatz im Text des Steuerelements und auf das derzeit ausgewählte Aufzählungszeichen in einer Liste von Aufzählungselementen aus. Um eine andere Einzugsebene auf eine gesamte Liste von Aufzählungselementen anzuwenden, muss der gesamte Text der Aufzählungselemente vor dem Festlegen der BulletIndent-Eigenschaft markiert werden.
Beispiel
Im folgenden Codebeispiel wird veranschaulicht, wie die SelectionBullet-Eigenschaft mit den Eigenschaften BulletIndent, 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()
' 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
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
SelectionBullet