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.
4 Answers, 1 is accepted
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.
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
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.