C# winform获取当前屏幕dpi缩小缩放比例

       /// 
        ///  获取电脑缩放比例
        /// 
        /// 
        public float GetWinScaling()
        {
            int dpiX;
            Graphics graphics = this.CreateGraphics();
            dpiX = (Int32)graphics.DpiX;

            if (dpiX == 96) { return 1; }
            else if (dpiX == 120) { return 1.25f; }
            else if (dpiX == 144) { return 1.5f; }
            else if (dpiX == 192) { return 2f; }
            else { return 1; }
        }

 

你可能感兴趣的:(C#,.net)