Rakesh Reddy
Rakesh Reddy

Reputation: 71

Win 8.1 DPI - WPF - How to find independent monitor/display's DPI

I have a Win 8.1 system installed on my system. I used to calculate DPI based on following in my WPF App (Win 7):

Matrix m = PresentationSource.FromVisual(Application.Current.MainWindow).CompositionTarget.TransformToDevice;

double dx = m.M11;
double dy = m.M22; 

With Win 8.1, I have the flexibility to have different DPI's set for different monitors. If I need to find out what are the DPI's of each monitor using WPF, how to achieve the same?

Upvotes: 2

Views: 398

Answers (1)

Rich Turner
Rich Turner

Reputation: 10984

I suggest you read Developing a Per-Monitor DPI-Aware WPF Application on MSDN. This article covers pretty most of what you'll need to support High-DPI WPF Windows 8.1 apps.

Note, though, that the examples given in the article above are mostly written in C++, but that's less of an issue for WinRT apps since C++ and C# can now interop more easily than before.

Upvotes: 2

Related Questions