RadRichTextEditor - How to modify the pop up Font window from Context Menu option?

1 Answer 125 Views
RichTextEditor
Amanda
Top achievements
Rank 1
Iron
Amanda asked on 22 Jul 2022, 10:08 PM

Hello everyone!

I have a RadRichTextEditor with Context Menu enabled. On that menu is a button called 'Font...' and it takes you to a Font Styles window where you can change basically all the font settings.

It also has a spot to do several different styles of underline (wave, dot-dashed, dot-dot-dashed, etc). However, for my purposes the only underline that will work is the default one (like this).

Is there a way that I can modify this pop up so I can remove groups as I want?

I've included a picture of the window I'm referring too, with the section I want to hide marked.

Thank you!

1 Answer, 1 is accepted

Sort by
1
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 25 Jul 2022, 06:30 AM

Hello, Amanda,   

You can create a derivative of the FontPropertiesDialog and override its OnLoad method. Thus, you can hide any undesired controls or make any changes. I have prepared a sample code snippet for your reference. Note that this is just a sample approach and it may not cover all possible cases. Feel free to modify and extend it in a way which suits your requirements best: 

        public RadForm1()
        {
            InitializeComponent();
            this.radRichTextEditor1.RichTextBoxElement.FontPropertiesDialog = new CustomFontPropertiesDialog();
        }

        public class CustomFontPropertiesDialog : 
            Telerik.WinForms.RichTextEditor.RichTextBoxUI.Dialogs.FontPropertiesDialog
        {
            protected override void OnLoad(EventArgs e)
            {
                base.OnLoad(e);
                RadGroupBox radGroupBoxUnderlineStyles = this.Controls["radGroupBoxUnderlineStyles"] as RadGroupBox;
                 foreach (RadCheckBox checkBox in radGroupBoxUnderlineStyles.Controls)
                {
                    if (checkBox.Text!="Line")
                    {
                        checkBox.Visible = false;
                    }
                }
                 radGroupBoxUnderlineStyles.Height -= 60;
            }
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.


Amanda
Top achievements
Rank 1
Iron
commented on 25 Jul 2022, 03:58 PM

Thank you so much Dess! This was exactly what I was trying to find!
Tags
RichTextEditor
Asked by
Amanda
Top achievements
Rank 1
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or