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

Localize color dialog, extend button width

1 Answer 45 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Mihajlo
Top achievements
Rank 1
Mihajlo asked on 05 Feb 2019, 06:10 PM

During localization it may happen that some buttons should become wider. In my case changing ColorDialogLocalizationProvider.CurrentProvider is not enough. For most dialogs that can appear from rich text editor I can replace them with inherited class and play with this.Controls property. But I don't see a way to do that for color dialog.

I could override three event handlers (ButtonBackColor_Click, ButtonForeColor_Click, ButtonParagraphBackColor_Click) of RichTextEditorRibbonBar and take and tweak the code that is there, but that feels like a kludge. What is the proper way to tweak control sizes in color dialogs created from rich text editor?

1 Answer, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 06 Feb 2019, 11:14 AM
Hi Mihajlo,

Thank you for writing.

There is no public API to allow modifications of the layout inside the color dialog or inside the user controls added to it. A possible solution might be, to create a custom RichTextEditorRibbonBar and change the locations of the controls added to the dialog form: 
public class MyRichTextEditorRibbonBar : RichTextEditorRibbonBar
{
    protected override void ButtonForeColor_Click(object sender, EventArgs e)
    {
        RadColorDialog dialog = new RadColorDialog();
        RadColorDialogForm dialogForm = (RadColorDialogForm)dialog.ColorDialogForm;
 
        if (dialogForm.Controls.Count > 0)
        {
            RadColorSelector colorSelector = dialogForm.Controls[0] as RadColorSelector;
            if (colorSelector != null)
            {
                foreach (Control c in colorSelector.Controls)
                {
                    // Here you can adjust the locations and size of the controls
                    Console.WriteLine(c.Text != "" ? c.Text : c.Name);
                }
            }
        }
 
        dialogForm.ThemeName = this.ThemeName;
        dialogForm.ShowIcon = false;
        dialogForm.ShowInTaskbar = false;
 
        if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
        {
            ChangeFontForeColorCommand command = new ChangeFontForeColorCommand(this.RichTextBoxActiveEditor);
            this.ExecuteCommand(command, (Telerik.WinControls.RichTextEditor.UI.Color)dialog.SelectedColor);
        }
    }
}

Let me know if you need further assistance.

Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
RichTextEditor
Asked by
Mihajlo
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or