This is useful for me because I have to map objects with a correct dimension on screen; if I’m using a 19″ lcd with 1280×1024 resolution and a normal 96dpi setting then in order to map a correct 1-inch square I have to write a xaml like this
<Rectangle Name="one_inch_side_on_19_inch_diag_display" Height="86" Width="86" Fill="Blue"/>
where Width and Height are put to 86 because
86 ~= 96 (dots-per-inch) * 17 (inches) / 19 (inches)
as windows assumes 96dpi on a 17″ monitor as the base to calculate dimensions…
Thanks
I found a similar question on http://www.c-sharpcorner.com. It provides below code
I tested it on my local machine which has 2 monitors and it return almost accurate result. (12.70 for my 13 inches and 23.98 for 24 inches screen.)