using System.Drawing; using WindowsDisplayAPI.Native.DeviceContext; using WindowsDisplayAPI.Native.DeviceContext.Structures; namespace WindowsDisplayAPI { /// /// Represents a possible display setting /// public class DisplayPossibleSetting { /// /// Creates a new DisplayPossibleSetting /// /// Display resolution /// Display frequency /// Display color depth /// Indicating if display is using interlaces scan out protected DisplayPossibleSetting(Size resolution, int frequency, ColorDepth colorDepth, bool isInterlaced) { ColorDepth = colorDepth; Resolution = resolution; IsInterlaced = isInterlaced; Frequency = frequency; } internal DisplayPossibleSetting(DeviceMode deviceMode) : this( new Size((int) deviceMode.PixelsWidth, (int) deviceMode.PixelsHeight), (int) deviceMode.DisplayFrequency, (ColorDepth) deviceMode.BitsPerPixel, deviceMode.DisplayFlags.HasFlag(DisplayFlags.Interlaced) ) { } /// /// Gets the color depth of the display monitor in bits per pixel /// public ColorDepth ColorDepth { get; } /// /// Gets the frequency of the display monitor in hz /// public int Frequency { get; } /// /// Gets a boolean value indicating if the display uses the interlaced signal /// public bool IsInterlaced { get; } /// /// Gets the size of the display monitor /// public Size Resolution { get; } /// public override string ToString() { return $"{Resolution} {(IsInterlaced ? "Interlaced" : "Progressive")} {Frequency}hz @ {ColorDepth}"; } } }