rev*_*kpi 12 c# silverlight silverlight-3.0 silverlight-4.0 windows-phone-7
如何从设置中获取设备的屏幕分辨率(Windows Phone)?
Dmi*_*nik 21
public void GetScreenResolution()
{
string ScreenWidth = Application.Current.Host.Content.ActualWidth.ToString();
string ScreenHeight = Application.Current.Host.Content.ActualHeight.ToString();
MessageBox.Show(ScreenWidth + "*" + ScreenHeight);
}
Run Code Online (Sandbox Code Playgroud)
这可能是了解您的应用运行的屏幕分辨率的更好方法.
if(App.Current.Host.Content.ScaleFactor == 100)
{
// WVGA
}
else if (App.Current.Host.Content.ScaleFactor == 160)
{
// WXGA
}
else if (App.Current.Host.Content.ScaleFactor == 150)
{
// 720p
}
Run Code Online (Sandbox Code Playgroud)
来源http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206974%28v=vs.105%29.aspx
| 归档时间: |
|
| 查看次数: |
17497 次 |
| 最近记录: |