예제 #1
0
 private static void MoveNewPrimary(Screen newPrimary, Screen oldPrimary)
 {
     WinApi.DEVMODE ndm4 = NewDevMode();
     ndm4.dmFields = WinApi.DEVMODE_Flags.DM_POSITION;
     ndm4.dmPosition.x = 0;
     ndm4.dmPosition.y = 0;
     WinApi.User_32.ChangeDisplaySettingsEx(newPrimary.ScreenDevice.DeviceName, ref ndm4, (IntPtr)null, (int)WinApi.DeviceFlags.CDS_SET_PRIMARY | (int)WinApi.DeviceFlags.CDS_UPDATEREGISTRY | (int)WinApi.DeviceFlags.CDS_NORESET, IntPtr.Zero);
 }
예제 #2
0
        private static void CommitChange(Screen newPrimary, Screen oldPrimary)
        {
            WinApi.DEVMODE ndm5 = NewDevMode();
            WinApi.User_32.ChangeDisplaySettingsEx(oldPrimary.ScreenDevice.DeviceName, ref ndm5, (IntPtr)null, (int)WinApi.DeviceFlags.CDS_UPDATEREGISTRY, (IntPtr)null);

            WinApi.DEVMODE ndm6 = NewDevMode();
            WinApi.User_32.ChangeDisplaySettingsEx(newPrimary.ScreenDevice.DeviceName, ref ndm6, (IntPtr)null, (int)WinApi.DeviceFlags.CDS_SET_PRIMARY | (int)WinApi.DeviceFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
        }
예제 #3
0
 private static void SwitchPrimaryScreen(Screen newPrimary, Screen oldPrimary)
 {
     MoveOldPrimary(newPrimary, oldPrimary);
     MoveNewPrimary(newPrimary, oldPrimary);
     CommitChange(newPrimary, oldPrimary);
 }