Esempio n. 1
0
        /// <summary>
        /// Returns a list of available display modes. (No modes that are smaller than 640x480/60 Hz and less bit depth then the current mode will be returned.)
        /// </summary>
        /// <returns>The available display modes as list of <see cref="DisplayMode"/> objects.</returns>
        public static List <DisplayMode> GetDisplayModes()
        {
            List <DisplayMode> displayModes = new List <DisplayMode>();

            DevMode displayMode = new DevMode();
            uint    modeNumber  = 0;

            displayMode.dmSize = (ushort)Marshal.SizeOf(displayMode);

            EnumDisplaySettings(null, DisplaySettingsMode.ENUM_CURRENT_SETTINGS, ref displayMode);
            uint currentBitDepth = displayMode.dmBitsPerPel;

            displayModes.Add(new DisplayMode(displayMode.dmPelsWidth, displayMode.dmPelsHeight, currentBitDepth, displayMode.dmDisplayFrequency));

            while (EnumDisplaySettings(null, modeNumber++, ref displayMode))
            {
                if (displayMode.dmPelsWidth >= 640 && displayMode.dmPelsHeight >= 480 && displayMode.dmBitsPerPel == currentBitDepth && displayMode.dmDisplayFrequency >= 60)
                {
                    displayModes.Add(new DisplayMode(displayMode.dmPelsWidth, displayMode.dmPelsHeight, currentBitDepth, displayMode.dmDisplayFrequency));
                }
            }

            return(displayModes);
        }
Esempio n. 2
0
 public static extern DISP_CHANGE ChangeDisplaySettingsEx(string lpszDeviceName, ref DevMode lpDevMode, HWND hwnd, CDS dwflags, IntPtr lParam);
Esempio n. 3
0
 public static extern DISP_CHANGE ChangeDisplaySettings(ref DevMode lpDevMode, CDS dwflags);
Esempio n. 4
0
 public static extern bool EnumDisplaySettings(string lpszDeviceName, uint iModeNum, ref DevMode lpDevMode);
Esempio n. 5
0
 public static extern bool EnumDisplaySettingsEx(string lpszDeviceName, uint iModeNum, ref DevMode lpDevMode, EDS dwFlags);
Esempio n. 6
0
		public static extern DISP_CHANGE ChangeDisplaySettingsEx(string lpszDeviceName, ref DevMode lpDevMode, HWND hwnd, CDS dwflags, IntPtr lParam);
Esempio n. 7
0
		public static extern DISP_CHANGE ChangeDisplaySettings(ref DevMode lpDevMode, CDS dwflags);
Esempio n. 8
0
		/// <summary>
		/// Returns a list of available display modes. (No modes that are smaller than 640x480/60 Hz and less bit depth then the current mode will be returned.)
		/// </summary>
		/// <returns>The available display modes as list of <see cref="DisplayMode"/> objects.</returns>
		public static List<DisplayMode> GetDisplayModes()
		{
			List<DisplayMode> displayModes=new List<DisplayMode>();

			DevMode displayMode=new DevMode();
			uint modeNumber=0;

			displayMode.dmSize=(ushort)Marshal.SizeOf(displayMode);

			EnumDisplaySettings(null, DisplaySettingsMode.ENUM_CURRENT_SETTINGS, ref displayMode);
			uint currentBitDepth=displayMode.dmBitsPerPel;

			displayModes.Add(new DisplayMode(displayMode.dmPelsWidth, displayMode.dmPelsHeight, currentBitDepth, displayMode.dmDisplayFrequency));

			while(EnumDisplaySettings(null, modeNumber++, ref displayMode))
			{
				if(displayMode.dmPelsWidth>=640&&displayMode.dmPelsHeight>=480&&displayMode.dmBitsPerPel==currentBitDepth&&displayMode.dmDisplayFrequency>=60)
					displayModes.Add(new DisplayMode(displayMode.dmPelsWidth, displayMode.dmPelsHeight, currentBitDepth, displayMode.dmDisplayFrequency));
			}

			return displayModes;
		}
Esempio n. 9
0
		public static extern bool EnumDisplaySettingsEx(string lpszDeviceName, uint iModeNum, ref DevMode lpDevMode, EDS dwFlags);
Esempio n. 10
0
		public static extern bool EnumDisplaySettings(string lpszDeviceName, uint iModeNum, ref DevMode lpDevMode);