0

I've got a VB.Net Windows Form application containing several controls (labels, groupboxes, comboboxes, etc.) This application is deployed to several PCs running Windows 10. There are also Win10 tablets connecting to these PCs via Remote Desktop. The issue is that the text on the form sometimes gets resized and overlaps onto other controls when viewed on the tablet. In other words, the text becomes too big.

I thought this was only happening when using Remote Desktop but today I saw it happen on a PC too. This is the first time this has happened. One difference is that the PC was re-imaged in the field instead of being brought back to the office first. The monitors used between the two locations are different, and I'm suspecting this has something to do with it. I know there are DPI and resolution factors to consider but don't fully understand how to rectify them in this case, or if they're even applicable.

Here's how it looks as designed and running on my dev PC:

enter image description here

And here's how it looks when running on the production PC (sorry for the grainy image):

enter image description here

Of note is that some text doesn't appear to get oversized, for example the "Currently: 6 ft/min". All fonts are Microsoft Sans Serif.

Suggestions?

Mike Lowery
  • 2,630
  • 4
  • 34
  • 44
  • 2
    Possible duplicate of [How to write WinForms code that auto-scales to system font and dpi settings?](https://stackoverflow.com/questions/22735174/how-to-write-winforms-code-that-auto-scales-to-system-font-and-dpi-settings) – Alexei Levenkov Jul 18 '19 at 23:26
  • [High DPI Desktop Application Development on Windows](https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows), [How can I update my WinForms app to behave better at high DPI, or at normal DPI on very large screens?](https://devblogs.microsoft.com/oldnewthing/?p=93695). Set your Forms to scale to DPI instead of Font, assign the Fonts explicitly (some controls inherit the Font, some don't). Also [Mixed-Mode DPI Scaling and DPI-aware APIs](https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-improvements-for-desktop-applications). – Jimi Jul 18 '19 at 23:43
  • @Jimi Those settings seem to affect all controls on the form, not just a few of them. In my case, only a few are being affected. – Mike Lowery Jul 18 '19 at 23:48
  • Your Forms' design needs to adapt to different High-Dpi settings. It's a design requirement. It has been for quite a long time now. If you try to patch up a couple of component, you'll find out you need another patch when a new monitor is connected or a new font scaling/High-Dpi mode is set. – Jimi Jul 18 '19 at 23:59
  • You should also make use of TableLayoutPanels/ FlowLayoutPanels to group your controls. It'll help to keep the layout stable, overall. Useful, in general, when a Form is resized because of user intervention. – Jimi Jul 19 '19 at 00:07

1 Answers1

0

The answer provided here worked for me by changing the compatibility settings for the executable. Another method is provided here but I haven't had a chance to test it yet.

Mike Lowery
  • 2,630
  • 4
  • 34
  • 44