Approved
Last Updated: 20 Nov 2017 16:18 by ADMIN
ADMIN
Hristo
Created on: 26 Sep 2017 10:04
Category: UI for WinForms
Type: Bug Report
1
FIX. RadDataEntry - the labels and the editors are not scaled when the form is opened as an MDI child with with high DPI settings
How to reproduce: enabled High DPI scaling and create a form as an MDI child with a RadDataEntry control in it
Workaround:  handle the Shown event of the MDI child and manually perform the scaling
private void radButtonElement1_Click(object sender, EventArgs e)
        {
            var view = new RadForm1
            {
                MdiParent = this
            };
            
            view.Shown += View_Shown;
            view.Show();
        }

        private void ScaleRadControls(Control c)
        {
            foreach (var item in c.Controls)
            {
                Control control = item as Control;
                if (control == null)
                {
                    continue;
                }

                this.mi.Invoke(control, new object[] { this.FormElement.DpiScaleFactor, BoundsSpecified.All });
                ScaleRadControls(control);
            }
        }

        MethodInfo mi;
        private void View_Shown(object sender, EventArgs e)
        {
            this.mi = typeof(Control).GetMethod("ScaleControl", BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(SizeF), typeof(BoundsSpecified) }, null);
            RadForm1 v = sender as RadForm1;
            if (v != null)
            {
                ScaleRadControls(v.radDataEntry1.PanelContainer);
            }
        }
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments