radRichTextEditor1.BackColor doesn't seem to work anymore

9 posts, 0 answers
  1. Martin Hamilton
    Martin Hamilton avatar
    18 posts
    Member since:
    Aug 2009

    Posted 14 Feb 2015 Link to this post

    With the previous editor - this code set the backcolor of the editor to white:
    radRichTextEditor1.BackColor = System.Drawing.Color.White

    But it doesn't seem to work in this new editor... is there different code required for the new editor?
  2. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 17 Feb 2015 Link to this post

    Hello Martin,

    Thank you for writing.

    Here is a sample code snippet demonstrating how to change the back color for the RadRichTextBox and RadRichTextEditor in the latest version:
    public Form1()
    {
        InitializeComponent();
     
        this.radRichTextBox1.RichTextBoxElement.BackColor = Color.Yellow;
        this.radRichTextBox1.RichTextBoxElement.DrawFill = true;
     
        this.radRichTextEditor1.RichTextBoxElement.BackColor = Color.Red;
    }

    I hope this information helps. Should you have further questions, I would be glad to help.
     
    Regards,
    Dess
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. dipan
    dipan avatar
    6 posts
    Member since:
    Mar 2011

    Posted 03 Mar 2015 in reply to Dess Link to this post

    i want some different  output like described in image.
    back color and richtext type box color are required diffrent
    How can we do that
    when we use
    this.radRichTextBox1.RichTextBoxElement.BackColor = Color.Yellow;
        this.radRichTextBox1.RichTextBoxElement.DrawFill = true;
     
        this.radRichTextEditor1.RichTextBoxElement.BackColor = Color.Red;

    it will not work.
  5. dipan
    dipan avatar
    6 posts
    Member since:
    Mar 2011

    Posted 06 Mar 2015 Link to this post

    waiting for your reply     
  6. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 06 Mar 2015 Link to this post

    Hello Dipan,

    Thank you for writing.

    RadRichTextBox.PageBackground property indicates what would be the page color. However, it is bound to the RichTextBoxElement.BackColor property. In order to achieve different colors for the RichTextBoxElement itself and the page you need to unbind them first:
    this.radRichTextBox1.LayoutMode = Telerik.WinControls.RichTextBox.Model.DocumentLayoutMode.Paged;
    this.radRichTextBox1.RichTextBoxElement.UnbindProperty(Telerik.WinControls.RichTextBox.RadRichTextBoxElement.PageBackgroundProperty);
     
    this.radRichTextBox1.RichTextBoxElement.BackColor = Color.Yellow;
    this.radRichTextBox1.RichTextBoxElement.DrawFill = true;
    this.radRichTextBox1.RichTextBoxElement.PageBackground = Color.Fuchsia;

    I would recommend you to use RadRichTextEditor which has addressed most of the disadvantages of the RadRichTextBox and introduces new features as well.

    I hope this information helps. Should you have further questions, I would be glad to help.
     
    Regards,
    Dess
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Martin Hamilton
    Martin Hamilton avatar
    18 posts
    Member since:
    Aug 2009

    Posted 06 Mar 2015 in reply to Dess Link to this post

    I think that the cause of confusion in this post is the I clearly indicated that I was referring to the radRichTextEditor control - but the responses from Telerik continue to refer to the RichTextBox control....

    To change the backcolor of the RichTextEditor the code is this: radRichTextEditor1.RichTextBoxElement.BackColor = Color.White
  8. dipan
    dipan avatar
    6 posts
    Member since:
    Mar 2011

    Posted 06 Mar 2015 Link to this post

    Hi Dess,

    Done.As per my Req.

    Thanks
    Dipan Chikani
  9. Kevin
    Kevin avatar
    3 posts
    Member since:
    Jun 2015

    Posted 26 Apr in reply to Dess Link to this post

    Dess,

    I am trying to do the same as the original post is trying to accomplish but with the RadRichTextBox. I can't seam to find out how to use the RichTextBoxElement.

     

    Example:

    var radRich = new RadRichTextBox();

    radRich.RadRichTextBoxElement.BackColor = Color.Blue;

     

    In this example I can't see the RadRichTextBoxElement.... How can I get access of this?

     

    Thanks.

    Kevin

  10. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 27 Apr Link to this post

    Hello Kevin,

    Thank you for writing.

    I would like to note that RadRichTextBox is obsolete and it is recommended to use the new RadRichTextEditor control which introduces a lot of improvements and new features. However, I have prepared a sample project demonstrating how to change the BackColor of RadRichTextBox.

    I hope this information helps. Should you have further questions I would be glad to help.

      Regards,
    Dess
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready