Unplanned
Last Updated: 21 May 2020 07:48 by ADMIN
Dan
Created on: 04 May 2020 16:17
Category: Form
Type: Bug Report
0
Form auto-size layout issue with DPI awareness and auto-sized RadLabel with Anchor on all sides

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.

 

 

Attached Files:
5 comments
ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 21 May 2020 07:48

Hello, Dan,

Your question has already been answered in the other thread (Ticket ID: 1468172) you have opened on the same topic. Please, see our answer there for more information.
We kindly ask you to use just one thread for a specific problem to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two or more tickets instead of one. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.

Thank you for your understanding.

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.
Dan
Posted on: 14 May 2020 15:39

Thanks Dess, I can try this.

However... another issue that is very common occurs without any AutoSize or Right/Bottom anchor in use. I'm finding that the form container scaling doesn't match when using DPI awareness. 

For example, consider the following sample images where all controls are NOT Autosize and all anchors are default (Top/Left), and the form Autosize is also false. The form is produced with nice margins when DPI awareness is disabled. However, when DPI awareness is enabled and the form is displayed on a 125% scale, the form margins at bottom and right is extended. This problem is worse with higher scales and larger forms.

Is there some approach that can eliminate this issue?

Thanks,

Dan.

 

ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 13 May 2020 08:42
Hello, Dan, 

Thank you for the provided clarification. If I understand your requirement correctly, you need to auto-size the form according to the bounds of the auto-sized label. Indeed, in this case the DPI scaling affects the form's auto-sizing behavior.

I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, due to the specificity of DPI scaling in combination with anchoring controls, the possible solution that I can suggest is to remove the bottom|right anchor for the label and apply some bottom margin for it to avoid overlapping with the button.

            this.lblMessage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top  | System.Windows.Forms.AnchorStyles.Left)))));
            this.lblMessage.Margin = new System.Windows.Forms.Padding(0, 0, 0, 50);

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.
Dan
Posted on: 08 May 2020 17:54

Hi Dess,

Thank you for your response!

However, the intent here is to automatically grow the dialog to try and fit the text without the user having to resize it.

The standard windows MessageBox class does this, and we have made something similar with a RadForm, but now, as we try to enable high DPI support... what we have is not working.

Our approach (that works with dpi aware disabled), is to have an auto-size label with min/max size, contained in an auto-size form with anchors. When the label size adjusts to the text, the form automatically grows.

There are a few cases like this in our code, and it seems to work well until we have tried the DPI awareness.

The strange behaviour does seem like a bug... however, maybe there is another solution that will work for our desired functionality, that will also work for high DPI. Please let me know your thoughts.

Thanks,

Dan.

 

 

 

ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 07 May 2020 06:47

Hello, Dan, 

The provided sample project and detailed explanation with screenshots are greatly appreciated. 

If you set the RadLabel.AutoSize property to false and keep the Anchor property, this will ensure that the label will grow up to the specified MaximumSize. Thus, if you allow the form to be resized (FormBorderStyle=Sizable), you will notice how the label's size is increased. I have tested this on my end with several DPI scaling values. The attached gif file illustrates the behavior on my end with 100% and 150% DPI scaling.

Please give this approach a try on your end and see how it would work. I believe that it would fit the resizing requirements for the label that you have.

I would recommend you to have a look at the following KB article which gives some hints and tips how to design a DPI-aware application which may be suitable for you: https://docs.telerik.com/devtools/winforms/knowledge-base/hdpi-tips-and-tricks 

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.