This is a migrated thread and some comments may be shown as answers.

radRichTextEditor1.BackColor doesn't seem to work anymore

12 Answers 346 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
Martin Hamilton asked on 14 Feb 2015, 02:27 PM
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?

12 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Feb 2015, 01:33 PM
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.

 
0
Dipan
Top achievements
Rank 1
answered on 03 Mar 2015, 07:12 PM
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.
0
Dipan
Top achievements
Rank 1
answered on 06 Mar 2015, 11:44 AM
waiting for your reply     
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Mar 2015, 11:48 AM
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.

 
0
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 06 Mar 2015, 12:04 PM
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
0
Dipan
Top achievements
Rank 1
answered on 06 Mar 2015, 01:03 PM
Hi Dess,

Done.As per my Req.

Thanks
Dipan Chikani
0
Kevin
Top achievements
Rank 1
answered on 26 Apr 2016, 01:45 PM

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

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Apr 2016, 11:01 AM
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.
0
Chuck
Top achievements
Rank 1
answered on 19 Dec 2016, 06:53 PM

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

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Dec 2016, 09:12 AM
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.
0
Chuck
Top achievements
Rank 1
answered on 20 Dec 2016, 01:15 PM
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...
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 21 Dec 2016, 09:35 AM
Hello Chuck, 

Thank you for writing back. 
 
It doesn't matter if you set the RichTextEditorRibbonBar.AssociatedRichTextEditor property at design time or at . 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.
Tags
RichTextEditor
Asked by
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Dipan
Top achievements
Rank 1
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
Kevin
Top achievements
Rank 1
Chuck
Top achievements
Rank 1
Share this question
or