Question

I have a windows app that runs correctly in my PC that is 96DPI but when I use it on a PC that has 120DPI the forms transform and all their components scramble.

How can I fix this?

Thanks.

Was it helpful?

Solution

It sounds like you need to use dynamic layout in your forms. You can use AutoSize, Docking/Anchoring, Padding, Margin, TableLayoutPanel, FlowLayoutPanel, etc, to structure your form so the actual positioning of your controls is done at run-time instead of compile-time. That way, your form will retain its layout even when the DPI is different. "Programming Microsoft Windows Forms" by Charles Petzold is a good book on Windows Forms. Chapter 3 of that book is full of information about how to use dynamic layout.

OTHER TIPS

if you mean you have the source for the application (development question) you can check the DPI setting of the display the application is running on and re-format your interface as needed depending on the resolution.

If you mean that you have a compiled application from somewhere else and you don't have the source code for it you can set your resolution to 96 DPI.

Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top