public override IList <SystemSettings.DisplayInfo> GetAllDisplays()
        {
            var result = new List <SystemSettings.DisplayInfo>();

            RectangleI area = new RectangleI(Vector2I.Zero, GetScreenSize());

            SystemSettings.DisplayInfo info = new SystemSettings.DisplayInfo("Primary", area, area, true);
            result.Add(info);

            return(result);
        }
Exemplo n.º 2
0
        //copy from WindowsPlatformFunctionality
        unsafe static bool MonitorEnumProc(IntPtr hMonitor, IntPtr hdcMonitor, ref RectangleI lprcMonitor, IntPtr dwData)
        {
            MONITORINFOEX info = new MONITORINFOEX();

            info.cbSize = sizeof(MONITORINFOEX);
            if (GetMonitorInfo(hMonitor, ref info))
            {
                SystemSettings.DisplayInfo displayInfo = new SystemSettings.DisplayInfo(new string( info.szDeviceName ), info.rcMonitor,
                                                                                        info.rcWork, (info.dwFlags & MONITORINFOF_PRIMARY) != 0);
                tempScreenList.Add(displayInfo);
            }

            return(true);
        }
Exemplo n.º 3
0
        public override IList <SystemSettings.DisplayInfo> GetAllDisplays()
        {
            //copy from WindowsPlatformFunctionality

            List <SystemSettings.DisplayInfo> result = new List <SystemSettings.DisplayInfo>();

            lock ( tempScreenList )
            {
                IntPtr hdc = GetDC(IntPtr.Zero);
                if (hdc != IntPtr.Zero)
                {
                    tempScreenList.Clear();

                    EnumDisplayMonitors(hdc, IntPtr.Zero, MonitorEnumProc, IntPtr.Zero);
                    ReleaseDC(IntPtr.Zero, hdc);

                    result.AddRange(tempScreenList);
                    tempScreenList.Clear();
                }
            }

            if (result.Count == 0)
            {
                RectangleI area = new RectangleI(Vector2I.Zero, GetScreenSize());
                SystemSettings.DisplayInfo info = new SystemSettings.DisplayInfo("Primary", area, area, true);
                result.Add(info);
            }

            return(result);

            //// it seems it works, but it's cross-platform?

            //// alternative implementation can be used. see SDL:
            //// IDXGIAdapter1.EnumOutputs, IDXGIOutput::GetDisplayModeList.

            //var wp = new WindowsPlatformFunctionality();
            //return wp.GetAllDisplays();
        }