VS 2022, Telerik 2022.2.510, NET 6.0 (sample app is attached)
1. Creating sample Telerik WinForms App.
2. Add a RadTextBox
3. Load Event with code
radTextBox1.Text = this.Size.ToString();
4. Run the App
5. Close the App
6. Move the RadTextBox Control at design time.
In design, the height of the form is 2 pixels taller.
Run these steps in a loop. After a few hours of work, the form exceeds the size of the screen.
Hi,
I am working on making our Winforms UI projects DPI aware to clean up fuzzy text in Windows 10.
I'm having an odd issue with some layouts. In one example, we have a simple form dialog that will grow with a label inside (similar to a windows message box). THe label is autosizing itself and has a minimum and maximum size set. This dialog is working fine without the DPI awareness, however, after enabling, the RadForm resizes to some strange size. I tried to investigate and it seems that the label is resizing to some large size and not respecting it's maximums (though this doesn't show when rendering as I've switched off the borders).
The label is resizing the form via anchors. I think probably there is a better way at layout here, but I'm wondering if the wild resizing may be considered a bug.
See images below.
I've also attached a project that reproduces this issue.
Dear support,
i have a RadForm and custom theme.
To reproduce the problem:
1. Configure 2. montior to have 200% Scale (Monitor2).
2. Start the solution on your main Monitor1 (with 100% Scale)
3. Click on button "radbutton1".
4. Move the shown RadForm1 from Monitor1 to Monitor2 and release it. The form will scale automatically.
5. Now move the RadForm1 back to the main Monitor1
Now you can see the effect from Form.png.
What is causing it and how to remove it?
The problem has some connection with the Anchor options from radButton1 and radButton2.
If i set them to "Top, Left", then the effect does not appear, but this way i have to set their location manually, or is there other option?
Regards,
Stoyan
To reproduce: Add a RadForm and at design time in the Properties section of Visual Studio try to customize some properties of the RadForm >> FormElement >> TitleBar, e.g. Padding, ForeColor. You will notice that even though you save the changes, they are not serialized. Thus, when you run the application, none of the changes are applied. Workaround: set the changes programmatically at run time.
To reproduce: run the sample project. It ends up leaving significant blank space on the right and the bottom, whereas the normal MS Form does NOT do this and works right. Workaround: in the Load event you can adjust the size with 10/15 px by setting the MaximumSize: private void Form1_Load(object sender, EventArgs e) { this.MaximumSize = new Size(this.Size.Width - 15, this.Size.Height - 10); }
How to reproduce: add a RadRibbonForm and set its MaximizeBox, MinimizeBox properties to false. Set the HelpButton property of the form to true and change its Icon. You will notice that the designer in Visual Studio has not updated. Workaround: use the element hierarchy editor and manually change the visibility of the elements.
To reproduce: - Set the StartPosition to CenterScreen - Show the form on a HDPI monitor Workaround: var form = new RadForm(); float dpiX, dpiY; Graphics graphics = this.CreateGraphics(); dpiX = graphics.DpiX /100; dpiY = graphics.DpiY /100; form.StartPosition = FormStartPosition.Manual; var monSize = Screen.FromControl(this).Bounds; var centerX = (monSize.Width / 2) - (form.DesktopBounds.Width * dpiX / 2); var centerY = (monSize.Height / 2) - (form.DesktopBounds.Height * dpiY/ 2); form.Location = new Point((int)centerX,(int) centerY); form.Show();
How to reproduce: set the Size property of the form in the designer of Visual Studio, pay attention to the serialized ClientSize value. Run the form and check the ClientSize, it has increased Workaround: public partial class Form2 : RadForm { public Form2() { InitializeComponent(); Padding p = TelerikDpiHelper.ScalePadding(this.FormBehavior.ClientMargin, new SizeF(1f / this.RootElement.DpiScaleFactor.Width, 1f / this.RootElement.DpiScaleFactor.Height)); this.MaximumSize = new Size(this.Size.Width - p.Horizontal, this.Size.Height - p.Vertical- this.FormBehavior.ClientMargin.Bottom + this.FormElement.TitleBar.Size.Height); } protected override void OnShown(EventArgs e) { base.OnShown(e); this.MaximumSize = new Size(0, 0); } }
To reproduce: follow the steps from the attached gif file. Workaround: public RadForm1() { InitializeComponent(); ((RadRibbonFormBehavior)this.FormBehavior).AllowTheming = false; }