Dpi awareness with Framework 4.8: C1FlexGrid font is not updated

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

    • Post Options:
    • Link

    Posted 21 July 2021, 12:48 am EST - Updated 3 October 2022, 1: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 21 July 2021, 6:35 pm 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 21 July 2021, 6:50 pm 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 9 February 2022, 9:10 pm EST

    Hi C1,

    any updates on this?

    Best regards

    Wolfgang

  • Posted 10 February 2022, 1: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 12 February 2024, 9:27 pm 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 13 February 2024, 11:19 pm 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, 12: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 14 February 2024, 8:03 pm 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.

Need extra support?

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

Learn More

Forum Channels