C# 获取DPI例子

public static float GetDpiX() 
        {
            System.Windows.Forms.Panel p = new System.Windows.Forms.Panel();
            System.Drawing.Graphics g = System.Drawing.Graphics.FromHwnd(p.Handle);

         
            return g.DpiX;
        }

 

posted @ 2021-11-12 15:39  212的s  阅读(170)  评论(0)    收藏  举报