コード例 #1
0
 public static extern ChangeDisplaySettingsReturnValue ChangeDisplaySettingsEx(
     string deviceName,
     IntPtr DevMode,            // graphics mode
     int hwnd,                  // not used; must be NULL
     uint dwflags,              // graphics mode options
     ref VIDEOPARAMETERS lParam // video parameters (or NULL)
     //IntPtr pLparam
     );
コード例 #2
0
        /// <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));
        }
コード例 #3
0
        /// <summary>
        /// If the display mode change was tempory then return to the default mode.
        /// </summary>
        public void recoverFromDynamicModeChange()
        {
            VIDEOPARAMETERS vp = new VIDEOPARAMETERS();

            ChangeDisplaySettingsEx(this.DeviceName, IntPtr.Zero, 0, 0, ref vp);
        }