/// <summary> /// 像素转毫米 宽度 /// </summary> /// <param name="length"></param> /// <param name="frmHandle">当前窗口/控件句柄</param> /// <returns></returns> public static float PixelsToMillimetersWidth(this float length, IntPtr frmHandle) { Graphics g = Graphics.FromHwnd(frmHandle); return length * (25.4f / g.DpiX); }