Ask WPF to ignore DPI settings

I have a wpf application designed for 1900x1200 resolution, but some of our users used window display settings to change the size by only 125% -150%, is there a way for the application to ignore these settings and still display normally?

I saw something like SetProcessDPIAware here , but havent been lucky with it.

Here is a screenshot of the application with display scaling up to 150% Application with scaling

As you can see, the application is too small and there is no way to configure it correctly.

+7
c # dpi wpf
source share
1 answer

Knowing the DPI in this case will not help. It will only change the CompositionTarget.TransformToDevice matrix, but the dimensions of the controls will not change.

I use the viewport to scale all the content. All sizes in my application are for Surface Pro 3 images:

<Window> <Viewbox Stretch="Uniform"> <Grid Width="1440" Height="2160"> <!-- ... --> </Grid> </Viewbox> </Window> 

You can calculate the viewport size based on the DPI of the screen. See this answer: https://stackoverflow.com/a/166778/

+1
source share

All Articles