Dpi awareness with Framework 4.8: C1FlexGrid font is not updated

Posted by: wknauf on 21 July 2021, 9:48 am EST

    • Post Options:
    • Link

    Posted 21 July 2021, 9:48 am EST - Updated 3 October 2022, 10:40 pm EST

    See attached sample (.NET framework 4.8).

    DpiTest48.zip

    To reproduce the issue, you need a recent Win10 with two screens. One screen is at 100%, the other at 125%. When the app is started (on my machine on the screen with 100%), click one of the two buttons and move the dialog form to the other screen and back.

    With AutoScaleMode = “Dpi”, the grid inherits the scaled form font.

    With AutoScaleMode = “Font”, the grid font does not scale, while the rest of the form changes as expected.

    At 100 percent:

    At 125 percent:

    We use “AutoScaleMode = Font”, as we apply the “SystemFonts.MessageBoxFont” to our application, depending on the OS settings.

    This might be a blocker to switch our app to 4.8 dpi awareness, if there is no workaround.

    Best regards

    Wolfgang

  • Posted 22 July 2021, 3:35 am EST

    Hi Wolfgang,

    We have reported this issue to the development team and will update you as soon as we have an update.

    In the meantime, you can use the OnDpiChanged method that you have overridden in the sample to update the font of the FlexGrid according to the form.

    Please refer to the sample attached.

    Regards

    Avnish

    [Internal Tracking ID : C1WIN-25352]

    DpiTestFlexGrid.zip

  • Posted 22 July 2021, 3:50 am EST

    Thanks - I came up with this workaround in the meantime. But it would be easier if the grid would handle this automatically ;-).

    Best regards

    Wolfgang

  • Posted 10 February 2022, 6:10 am EST

    Hi C1,

    any updates on this?

    Best regards

    Wolfgang

  • Posted 10 February 2022, 10:28 pm EST

    Hi,

    We are getting in touch with the development team to get updates on this and will let you know as soon as we hear from them.

    Regards

    Avnish

  • Posted 13 February 2024, 6:27 am EST

    I think we can close this, as we moved to .NET6 already, which has better support for Dpi awareness. The problem still seems to exists for Framework 4.8, but not in .NET6.

    I updated the old .NET 4.8 sample to use recent nuget packages: here the grid still has the wrong font.

    DpiTest48_2024-02-13.zip

    For .NET6, it works:

    DpiTest6_2024-02-13.zip

    We did not enable DPI awareness in our application because of layout bugs in the .NET6 runtime, but those are said to be fixed in .NET8, so we will give it another try when we migrate to .NET8.

    Best regards

    Wolfgang

  • Posted 14 February 2024, 8:19 am EST

    Hello Wolfgang,

    Apologies for the inconvenience.

    We did a general search on internet and came across a StackOverflow thread: https://stackoverflow.com/questions/2973165/autoscalemode-problems-with-changed-default-font

    A workaround that we can use here is to update the grid’s font when DPI changes. Please refer to the attached modified sample (see DpiTest48_Mod.zip)

    We are getting in touch with developers regarding this and will keep you updated with the necessary updates.

    Regards,

    Uttkarsh.

  • Posted 14 February 2024, 9:38 am EST

    Yep, that would the workaround for this issue. But as I wrote, it does not seem to be relevant for .NET6. So, from my side, you can close it, if you don’t consider it relevant for other users who stay with .NET 4.8. But it does not seem to be relevant, as you should have received bug reports already :wink:

    Best regards

    Wolfgang

  • Posted 15 February 2024, 5:03 am EST

    Hello Wolfgang,

    Thank you for your insights.

    While we acknowledge that you have moved to .NET 6 and are not encountering this issue but we’ll keep it posted on any updates in this thread. This information may prove beneficial to others still working on .NET Framework.

    Regards,

    Uttkarsh.

  • Posted 19 September 2024, 5:45 am EST

    Seems this was changed in .672:

    [FlexGrid] FlexGrid font was not updated if form AutoScaleMode was set to Font. (Jira:C1WIN-25352)

    I hope this has no impact on the .NET 6 controls, as the issue only happened with .NET 4.8.

    Best regards

    Wolfgang

  • Posted 20 September 2024, 12:23 am EST

    Hello,

    Yes, the issue has been fixed in the 672 build for .NET framework FlexGrid.

    I hope this has no impact on the .NET 6 controls, as the issue only happened with .NET 4.8.

    Yes, it should not impact NET6,8 FlexGrid. We tested for NET8 FlexGrid and did not observe the behavior. However, if you observe any discrepancies, please do let us know so that we can also look into it.

    Regards,

    Uttkarsh.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels