locked
Rich Text Box in Windows Forms? RRS feed

  • Question

  •  Hi guys,

    I am trying to use a Rich Text Box in my Windows forms application.I want features like Bold,Italics,Font etc.

    I dragged and dropped the Rich Text Box in to Form,but i don't see that Panel or Tool bar with all these buttons.WHat i have to do to Enable that??

    Any help is Appreciated....

    Thanks in Advance

    Anooj

    Monday, October 19, 2009 7:12 AM

Answers

    • Proposed as answer by Aland Li Tuesday, October 20, 2009 8:37 AM
    • Marked as answer by Aland Li Monday, October 26, 2009 2:57 AM
    Monday, October 19, 2009 7:30 AM
  • Hi anooj,

    We can select the text the style of which needs to be modified at first. Then we need to set the SelectionFont property to set the selected text bold. This is a code snippet:
        //select the text ths style of which needs to be modified
        richTextBox1.Select(0,10);
        //Set the text bold.
        richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont,FontStyle.Bold);


    Regards,
    Aland Li
    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    • Proposed as answer by Aland Li Tuesday, October 20, 2009 8:37 AM
    • Marked as answer by Aland Li Monday, October 26, 2009 2:57 AM
    Tuesday, October 20, 2009 8:36 AM

All replies

    • Proposed as answer by Aland Li Tuesday, October 20, 2009 8:37 AM
    • Marked as answer by Aland Li Monday, October 26, 2009 2:57 AM
    Monday, October 19, 2009 7:30 AM
  • Hi anooj,

    We can select the text the style of which needs to be modified at first. Then we need to set the SelectionFont property to set the selected text bold. This is a code snippet:
        //select the text ths style of which needs to be modified
        richTextBox1.Select(0,10);
        //Set the text bold.
        richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont,FontStyle.Bold);


    Regards,
    Aland Li
    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    • Proposed as answer by Aland Li Tuesday, October 20, 2009 8:37 AM
    • Marked as answer by Aland Li Monday, October 26, 2009 2:57 AM
    Tuesday, October 20, 2009 8:36 AM
  • These features are not in UI yet and you should add them yourself by using some methods and properties in RichTextBox class.


    Wednesday, October 21, 2009 7:20 AM