{
object temp;
if (!DeviceExtendedProperties.TryGetValue("PhysicalScreenResolution", out temp))
return "not available, sorry";
var screenResolution = (Size)temp;
// Can query for RawDpiY as well, but it will be the same value
if (!DeviceExtendedProperties.TryGetValue("RawDpiX", out temp) || (double)temp == 0d)
return "not available, sorry";
var dpi = (double)temp;
var screenDiagonal = Math.Sqrt(Math.Pow(screenResolution.Width / dpi, 2) +
Math.Pow(screenResolution.Height / dpi, 2));
var width = App.Current.Host.Content.ActualWidth;
return String.Format("{0} x {1}; {2:0.0#} raw scale; {3:0.0}\"",
screenResolution.Width, screenResolution.Height, screenResolution.Width / width,
screenDiagonal);
}
引用通告地址 (0):
http://www.cnng.net/blog/trackback.asp?tbID=80
http://www.cnng.net/blog/trackback.asp?tbID=80&CP=GBK
http://www.cnng.net/blog/trackback.asp?tbID=80
http://www.cnng.net/blog/trackback.asp?tbID=80&CP=GBK