Unplanned
Last Updated: 26 May 2020 09:09 by ADMIN
Dan
Created on: 26 May 2020 09:02
Category: Form
Type: Bug Report
0
RadForm: FormStartPosition.CenterParent is not respected when DPI scaling is higher than 100%

Please run the sample project on 100% and 150% DPI scaling. You will notice that with 100% the shown form is centered to its parent, but with 150% it is shifted:

1 comment
ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 26 May 2020 09:09

Hello, Dan,

I confirm that this is an issue when showing a form on a monitor with higher than 100% DPI scaling.

Currently, the possible solution that I can suggest is to calculate and adjust the location programmatically:

        private void btnLaunchDialog_Click(object sender, EventArgs e)
        {
            //workaround
            RadForm1 f = new RadForm1();
            f.StartPosition = FormStartPosition.Manual;
            int x = this.Location.X + this.Size.Width / 2 - f.Size.Width / 2;
            int y = this.Location.Y + this.Size.Height / 2 - f.Size.Height / 2;
            f.DesktopLocation = new Point(x, y);
            f.Shown += F_Shown;
            f.Opacity = 0;
            f.ShowDialog();
        }

        private void F_Shown(object sender, EventArgs e)
        {
            RadForm f = sender as RadForm; 
            int x = this.Location.X + this.Size.Width / 2 - f.Size.Width / 2;
            int y = this.Location.Y + this.Size.Height / 2 - f.Size.Height / 2;
            f.DesktopLocation = new Point(x, y);
            f.Opacity = 1;
        }

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

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.