uwp - 获取当前屏幕宽高/应用宽高

原文: uwp - 获取当前屏幕宽高/应用宽高

  

public static Size GetScreen()
        {
            var applicationView = ApplicationView.GetForCurrentView();
            var displayInformation = DisplayInformation.GetForCurrentView();
            var bounds = applicationView.VisibleBounds;
            var scale = displayInformation.RawPixelsPerViewPixel;
            var size = new Size(bounds.Width * scale, bounds.Height * scale);
            return size;
            
        }
//double width = GetScreen().Width;当前屏幕宽度
//double height = GetScreen().Height;当前屏幕高度

  

你可能感兴趣的:(uwp - 获取当前屏幕宽高/应用宽高)