如何获取 Windows Phone 8 设备的屏幕尺寸? [英] How to get Screen size of a windows phone 8 device?

查看:33
本文介绍了如何获取 Windows Phone 8 设备的屏幕尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找如何获得 Windows Phone 8 设备的实际屏幕尺寸,我找到了这种方法,但它仅适用于具有 GDR3 更新的设备

I was searching for how can i get the Actual screen size of a windows phone 8 device , i've found this method but it work only with Devices With GDR3 update

推荐答案

更新:我找到了这个方法

private void getScreenInfo() 
{
    double dpix = -1.01;
    double screensize = -1.01;
    double dpiy = -1.01;
    Size res;
    try {
        dpix = (double)DeviceExtendedProperties.GetValue("RawDpiX");
        dpiy = (double)DeviceExtendedProperties.GetValue("RawDpiY");
        res = (Size)DeviceExtendedProperties.GetValue("PhysicalScreenResolution");
        screensize = Math.Sqrt(Math.Pow(res.Width / dpix, 2) + Math.Pow(res.Height / dpiy, 2));
    }
    catch (Exception e) {
    }
}

这篇关于如何获取 Windows Phone 8 设备的屏幕尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆