static float GetDpiX() { float xDpi, yDpi; using( Graphics g = Graphics.FromHwnd( IntPtr.Zero ) ) { xDpi = g.DpiX; yDpi = g.DpiY; } return xDpi; }