UWP使用DisplayInformation获取屏幕size大小

        var displayInformation = DisplayInformation.GetForCurrentView();//
        var screenSize = new Size(displayInformation.ScreenWidthInRawPixels, displayInformation.ScreenHeightInRawPixels);获取分辨率宽与高
        var resolutionScale = displayInformation.ResolutionScale.ToString();
        var resolutionScalevalue = Convert.ToDouble(Regex.Replace(resolutionScale, @"(^(" + "Scale" + ")" + (true ? "*" : "") + "|(" + "Percent" + ")" + (true ? "*" : "") + "$)", "")) / 100;获取当前显示的百分比
        CurrentDisplayHeight = screenSize.Height / resolutionScalevalue;//实际高度
        CurrentDisplayWidth = screenSize.Width / resolutionScalevalue ;实际宽度

window.current获取当前app的大小:

        ScrollViewer.Height = Window.Current.Bounds.Height - bootHeight -55;

你可能感兴趣的:(uwp学习,uwp开发)