/// <summary> /// A private helper methods used to derive a DisplaySettings object from the DEVMODE structure. /// </summary> /// <param name="idx">The mode index attached with the settings. Starts form zero. Is -1 for the current settings.</param> /// <param name="mode">The current DEVMODE object represents the display information to derive the DisplaySettings object from.</param> private static DisplaySettings CreateDisplaySettingsObject(int idx, SafeNativeMethods.DEVMODE mode) { return new DisplaySettings() { Index = idx, Width = (int)mode.dmPelsWidth, Height = (int)mode.dmPelsHeight, Orientation = (Orientation)mode.dmDisplayOrientation, BitCount = (int)mode.dmBitsPerPel, Frequency = (int)mode.dmDisplayFrequency, DeviceName = mode.dmDeviceName }; }
/// <summary> /// A private helper methods used to derive a DisplaySettings object from the DEVMODE structure. /// </summary> /// <param name="idx">The mode index attached with the settings. Starts form zero. Is -1 for the current settings.</param> /// <param name="mode">The current DEVMODE object represents the display information to derive the DisplaySettings object from.</param> private static DisplayDevice CreateDisplayDeviceObject(int idx, SafeNativeMethods.DISPLAY_DEVICE dev) { return new DisplayDevice() { Index = idx, Cb = dev.cb, DeviceName = dev.DeviceName, DeviceString = dev.DeviceString, StateFlags = dev.StateFlags, DeviceID = dev.DeviceID, DeviceKey = dev.DeviceKey }; }