radRichTextEditor1.BackColor doesn't seem to work anymore

13 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
    1772 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. 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.
  4. dipan
    dipan avatar
    6 posts
    Member since:
    Mar 2011

    Posted 06 Mar 2015 Link to this post

    waiting for your reply     
  5. Dess
    Admin
    Dess avatar
    1772 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.

     
  6. 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
  7. 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
  8. Kevin
    Kevin avatar
    3 posts
    Member since:
    Jun 2015

    Posted 26 Apr 2016 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

  9. Dess
    Admin
    Dess avatar
    1772 posts

    Posted 27 Apr 2016 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.
  10. Chuck
    Chuck avatar
    2 posts
    Member since:
    Nov 2016

    Posted 19 Dec 2016 Link to this post

    None of these examples are helpful but rather confusing. Im just trying to set the default settings for the new RadRichTextEditor.

    I have the editor and I am programmatically binding it to RichTextRibbonBar by means of the AssociatedRichTextEditor method, i.e

    rtfRibbonBar.AssociatedRichTextEditor = rtfEditor

    However when I start to type in the editor all the text is coming up Red underlined. SO... by using the above examples, I am trying to set these to basic black on white NON-Underlined text and I cannot seem to be able to do that...

    eg:

    ''    oRTFEditor = Telerik.WinControls.UI.RadRichTextEditor
    ''AND rtfRibbonBar = Telerik.WinControls.UI.RichTextEditorRibbonBar
     rtfRibbonBar.AssociatedRichTextEditor = oRTFEditor
           
     oRTFEditor.RichTextBoxElement.UnbindProperty(Telerik.WinControls.RootRadElement.ForeColorProperty)
            oRTFEditor.RichTextBoxElement.UnbindProperty(Telerik.WinControls.RootRadElement.FontProperty)
            oRTFEditor.RichTextBoxElement.UnbindProperty(Telerik.WinControls.RootRadElement.DefaultSizeProperty)
            oRTFEditor.RichTextBoxElement.ChangeFontFamily(New Telerik.WinControls.RichTextEditor.UI.FontFamily("Arial"))
            oRTFEditor.RichTextBoxElement.ChangeFontSize(8)
            oRTFEditor.RichTextBoxElement.ChangeFontStyle(Telerik.WinControls.RichTextEditor.UI.FontStyles.Normal)
            oRTFEditor.RichTextBoxElement.ChangeFontWeight(Telerik.WinControls.RichTextEditor.UI.FontWeights.Normal)
            oRTFEditor.RichTextBoxElement.ChangeTextForeColor(Telerik.WinControls.RichTextEditor.UI.Colors.Black)
            oRTFEditor.RichTextBoxElement.ChangeUnderlineDecoration(Telerik.WinForms.Documents.UI.TextDecorations.DecorationProviders.UnderlineTypes.None)
            oRTFEditor.RichTextBoxElement.BackColor = Color.White
            oRTFEditor.RichTextBoxElement.ForeColor = Color.Black
     
     oRTFEditor.DocumentInheritsDefaultStyleSettings = True

     

    BUT its no effect, when I start typing in the editor its ALWAYS red underlined text...I cant find any direct sample in your forums or FAQ to help. Is there some simple idea I am misunderstanding, it shouldn't be this hard and sounds quite simple to do

     

  11. Dess
    Admin
    Dess avatar
    1772 posts

    Posted 20 Dec 2016 Link to this post

    Hello Chuck,

    Thank you for writing.  

    By default, when you add an empty RadRichTextEditor on the form, the default font is Verdana, 12 and the fore color is normal black. If you have some other initial settings, I suppose that you probably load a document with the specific style. However, when using the provided code snippet for changing the editor's style and the user starts typing, the text is styled as expected. Please refer to the attached gif file illustrating the result on my end. Am I missing something? I have attached my sample project. Could you please specify the exact steps how to reproduce the problem? Alternatively, you can modify the sample project in a way to replicate the undesired style and submit a support ticket where you can provide the modified project. This would be the fastest way to investigate the precise case and assist you further. Thank you.

    I am looking forward to your reply.

    Regards,
    Dess
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  12. Chuck
    Chuck avatar
    2 posts
    Member since:
    Nov 2016

    Posted 20 Dec 2016 in reply to Dess Link to this post

    Thanks Dess. Ill try and get my snippets into project to help under a support ticket. The main/only difference is that I am dynamically using/assigning the ribbonbar during runtime to the radrichtexteditor, not statically assigning it at design time. I have 2 editors on a form BUT using 1 ribbon bar to handle both. Based on which editor I have focus on, that's the one the ribbon bar handles (using AssociatedRichTextEditor property in my example)...Does that make sense? ...The main reason for doing that is realestate, I have several editors on one scrolling form. Having a ribbonbar for each one take up too make realestate so I came up with this idea. Is this not recommended?,...since I cant get it to work as your straight forward example, though I thought it should...
  13. Dess
    Admin
    Dess avatar
    1772 posts

    Posted 21 Dec 2016 Link to this post

    Hello Chuck, 

    Thank you for writing back. 
     
    It doesn't matter if you set the RichTextEditorRibbonBar.AssociatedRichTextEditor property at design time or at run time. It is not supposed to affect the style of the currently associated RadRichTextEditor. Providing a sample project in a new support ticket would be greatly appreciated as it would be the fastest way to investigate the precise case and assist you further. Thank you in advance. 

    If you have any additional questions, please let me know. 

    Regards,
    Dess
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top