var mc = new ManagementClass("Win32_DesktopMonitor");
            double height = 0;
            double width = 0;
            foreach (var a in mc.GetInstances())
            {
                string path;
                Trace.WriteLine(path = a.Properties["PNPDeviceID"].Value.ToString());
                var bytes = (byte[])Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Enum\" + path + @"\Device Parameters").GetValue("EDID");
                height = bytes[22];
                width = bytes[21];
                Trace.WriteLine("" + bytes[21].ToString());
                Trace.WriteLine("" + bytes[22].ToString());
            }
            height = height * 10;
            width = width * 10;
            double x1 = SystemParameters.PrimaryScreenWidth;//得到屏幕整体宽度
            double y1 = SystemParameters.PrimaryScreenHeight;//得到屏幕整体高度

要引用系统自带的Management.dll程序集,然后访问EDID的数据,EDID的数组中的22位和23位是屏幕的物理宽和高。

相关文章:

  • 2022-01-08
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
  • 2021-11-17
  • 2022-01-08
  • 2022-01-08
猜你喜欢
  • 2022-01-22
  • 2021-06-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2021-11-18
相关资源
相似解决方案