/// <summary> /// /// </summary> /// <param name="index">The graphics mode index</param> /// <param name="displayCompatableOnly">Include modes the video card can produce, but the monitor can't use.</param> /// <param name="changeType">Nature of change to perform</param> /// <returns></returns> public ChangeDisplaySettingsReturnValue changeResolution(int index, bool displayCompatableOnly, displayChangeType changeType) { DEVMODE devmode = initNewDEVMODE(); EnumDisplaySettingsEx(this.DeviceName, index, ref devmode, displayCompatableOnly ? 0 : EDS_RAWMODE); //return ChangeDisplaySettingsEx(DeviceName, devmode, 0/*null*/, (int)changeType, IntPtr.Zero); VIDEOPARAMETERS vp = new VIDEOPARAMETERS(); return(ChangeDisplaySettingsEx(DeviceName, ref devmode, 0 /*null*/, (uint)changeType, ref vp)); }
/// <summary> /// Changes the screen mode of the specified device /// </summary> /// <param name="g">The graphics mode</param> /// <param name="displayCompatableOnly">Include modes the video card can produce, but the monitor can't use.</param> /// <param name="changeType">Nature of change to perform</param> /// <returns>ChangeDisplaySettingsReturnValue as per winsdk</returns> public ChangeDisplaySettingsReturnValue changeResolution(graphicsMode g, bool displayCompatableOnly, displayChangeType changeType) { int index = getIndexOfMode(g, displayCompatableOnly); if (index != -1) { return(changeResolution(index, displayCompatableOnly, changeType)); } else { return(ChangeDisplaySettingsReturnValue.DISP_CHANGE_BADMODE); } }