Excel add in high DPI problem

5 posts, 0 answers
  1. Christian
    Christian avatar
    44 posts
    Member since:
    May 2012

    Posted 13 Dec 2018 Link to this post

    Hi,

    Changing the size of a form at runtime somehow messes up the control size / layout if DPI / scaling ist at >100%.

    This only happens if the form is loaded inside an Excel add in, if the same form is loaded in a normal WinForms project everything is fine.

    Attached is a sample Excel add in project.

     

    Kind regards,

    Christian

  2. Christian
    Christian avatar
    44 posts
    Member since:
    May 2012

    Posted 13 Dec 2018 in reply to Christian Link to this post

    Sample project (rename to .zip)
  3. Hristo
    Admin
    Hristo avatar
    1506 posts

    Posted 14 Dec 2018 Link to this post

    Hi Christian,

    Thank you for writing. I could not observe the reported behavior. I am attaching a screenshot showing the result on my end running the application on 150% scaling. Can you please try changing the RadForm with a standard form?  You can also set the RadControl.EnableDpiScaling property to false

    Let me know if you need further assistance.

    Regards,
    Hristo
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  4. Christian
    Christian avatar
    44 posts
    Member since:
    May 2012

    Posted 18 Dec 2018 in reply to Hristo Link to this post

    Hi Hristo,

    I've modified the example. (Tested with 200% scaling). Please use a slow-ish machine to test or a VM with low cpu/ram/graphic settings.

    EnableDpiScaling true/false -> see attached screenshots

    Using Form instead of RadForm makes a difference but the controls are still not 100% correct 

     

  5. Hristo
    Admin
    Hristo avatar
    1506 posts

    Posted 20 Dec 2018 Link to this post

    Hi Christian,

    Thank you for writing back.

    The Excel add-in is being loaded in the run-time of Excel which is a DPI-aware application. The screenshots indicate that the layout is distorted and this can happen after the controls` sizes increase. Their locations, however, will not change and it will be necessary to change them. This can be a big task depending on how complex the layout is. A possible solution is to design your form to be auto-sized and the controls to flow. Generally anchors and using the Dock property helps. You can refer to the following articles with more information on how this can be accomplished:
    Please also make sure that you are working with the Winforms designer only on machines which are at 96 DPI (100%). Otherwise, you are risking to double-scale your app in a DPI-aware environment. This is a Visual Studio issue and it is logged here: https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/7373263-winforms-designer-dpi-lock.

    I hope this information is useful.

    Regards,
    Hristo
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top