How do you deal with an adaptive window sizing in higher resolutions ? #1001
-
Hello, so I managed to get around being unable to set the window size directly in the xaml like WPF , using the Win32Interop, ok so far so good, the window was set to say 500,500. The issue is now that is a fixed pixel size , my app is meant to be small, & not non-resizable ( already managed to figure this out with the presenter as OverlappedPresenter) When I test my app made in 1080p machine looks ok , I switch to my machine with 3K resolution and now the window is smaller but worst part all the stack panel /grid items are going inward, it seems with the elements inside being all cutoff .. Is there a way to dynamically scale this window but still retain a certain proportion to keep minimal like a 600 x 600 pixels window , something similar to the " If you stumble on this post and know of an approach to this I would appreciate it :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
What you are describing is a DPI issue. Let's use two fictional monitors for example, both having physical dimensions of 1'x1'. However, their resolutions are different, monitor A is 1024x1024 whereas monitor B is 4096x4096. What has changed? The physical size of the pixels, monitor B having a pixel density 4x higher than monitor A. How do we overcome this? Measuring how many pixels span an inch which luckily is done for you. Taking into account the difference in DPI between different monitors is the first step in making your apps DPI aware and fortunately there are frameworks which can perform the heavy lifting for you. |
Beta Was this translation helpful? Give feedback.
What you are describing is a DPI issue. Let's use two fictional monitors for example, both having physical dimensions of 1'x1'. However, their resolutions are different, monitor A is 1024x1024 whereas monitor B is 4096x4096. What has changed? The physical size of the pixels, monitor B having a pixel density 4x higher than monitor A. How do we overcome this? Measuring how many pixels span an inch which luckily is done for you. Taking into account the difference in DPI between different monitors is the first step in making your apps DPI aware and fortunately there are frameworks which can perform the heavy lifting for you.