Setting indents, hanging indents, and bulleted paragraphs with the Windows Forms RichTextBox Control

Source: Internet
Author: User

The Windows FormsRichTextBoxControl has numerous options for formatting the text it displays. You can format selected paragraphs as bulleted lists by settingSelectionbulletProperty. You can also useSelectionindent,Selectionrightindent, AndSelectionhangingindentProperties to set the indentation of paragraphs relative to the left and right edges of the control, and the left edge of other lines of text.

To Format a paragraph as a bulleted list

  • SetSelectionbulletPropertyTrue.

    ' Visual Basic    RichTextBox1.SelectionBullet = True    // C#    richTextBox1.SelectionBullet = true;    // C++    richTextBox1->SelectionBullet = true;

To indent a paragraph

  • SetSelectionindentProperty to an integer representing the distance in pixels between the left edge of the control and the left edge of the text.
  • SetSelectionhangingindentProperty to an integer representing the distance in pixels between the left edge of the first line of text in the paragraph and the left edge of subsequent lines in the same paragraph. The value ofSelectionhangingindentProperty only applies to lines in a paragraph that have wrapped below the first line.
  • SetSelectionrightindentProperty to an integer representing the distance in pixels between the right edge of the control and the right edge of the text.
    ' Visual Basic    RichTextBox1.SelectionIndent = 8    RichTextBox1.SelectionHangingIndent = 3    RichTextBox1.SelectionRightIndent = 12    // C#    richTextBox1.SelectionIndent = 8;    richTextBox1.SelectionHangingIndent = 3;    richTextBox1.SelectionRightIndent = 12;    // C++    richTextBox1->SelectionIndent = 8;    richTextBox1->SelectionHangingIndent = 3;    richTextBox1->SelectionRightIndent = 12;

    NoteAll these properties affect any paragraphs that contain selected text, and also the text that is typed after the current insertion point. for example, when a user selects a word within a paragraph and then adjusts the indentation, the new settings will apply to the entire paragraph that contains that word, and also to any paragraphs subsequently entered after the selected paragraph. for information on selecting text programmatically, see textboxbase. select method.

See also

RichTextBox class | RichTextBox Control (Windows Forms) | controls you can use on Windows Forms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.