public List <IDisplayMode> GetModes(bool list_all) { if (!m_Exists) { return(null); } List <IDisplayMode> list = new List <IDisplayMode>(); int index = 0; DeviceModeInfoStruct dm = new DeviceModeInfoStruct(); dm.Size = DeviceModeInfoStruct.StructSize; while (IGE.Platform.Win32.API.Externals.EnumDisplaySettings(m_DeviceInfo.DeviceName, index++, ref dm)) { if (!list_all) { if (dm.DisplayOrientation != 0) { continue; // list only normal orientation modes } if (dm.DisplayFixedOutput != 0) { continue; // list only default output modes } if (dm.DisplayFlags != 0) { continue; // list only noninterlaced and nongrayscale modes } } dm.DeviceName = Id; list.Add(new DisplayMode(dm)); dm = new DeviceModeInfoStruct(); dm.Size = DeviceModeInfoStruct.StructSize; } return(list); }
public static extern int ChangeDisplaySettingsEx([MarshalAs(UnmanagedType.LPTStr)] string lpszDeviceName, [In, Out] ref DeviceModeInfoStruct lpDevMode, IntPtr hWnd, ChangeDisplaySettingsEnum dwflags, IntPtr lParam);
public static extern int ChangeDisplaySettings([In, Out] ref DeviceModeInfoStruct device_mode, ChangeDisplaySettingsEnum flags);
public static extern Boolean EnumDisplaySettings([MarshalAs(UnmanagedType.LPTStr)] string device_name, int graphics_mode, [In, Out] ref DeviceModeInfoStruct device_mode);
internal DisplayMode(DeviceModeInfoStruct dm) { m_DeviceMode = dm; }