Esempio n. 1
0
 public WindowsMonitor(DisplayDevice device)
 {
     Name = device.DeviceName;
     _modes = new List<IMonitorMode>();
     var mode = new DeviceMode();
     var num = -1;
     while (User32.EnumDisplaySettings(device.DeviceName, num++, ref mode) !=0)
     {
         _modes.Add(new MonitorMode( mode.PelsWidth, mode.PelsHeight,mode.BitsPerPel,mode.DisplayFrequency));
     }
 }
Esempio n. 2
0
 public bool SetMode(IMonitorMode mode)
 {
     throw new NotImplementedException();
     var dm = new DeviceMode()
         {
             PelsWidth = mode.Width,
             PelsHeight = mode.Height,
             BitsPerPel = mode.BitsPerPixel,
             DisplayFrequency = mode.Frequency,
             Fields = DM.PelsWidth | DM.PelsHeight | DM.BitsPerPixel | DM.DisplayFrequency
         };
     return User32.ChangeDisplaySettingsEx(Name, dm, IntPtr.Zero, ChangeDisplaySettingsEnum.Fullscreen, IntPtr.Zero) == 0;
 }
        public void SetFullscreen()
        {
            var exStyle = ExtendedWindowStyle.ApplicationWindow;
            var style = WindowStyle.Popup;

            var dm = new DeviceMode
            {
                Size = DeviceMode.SizeInBytes,
                Position = WinPoint.FromPoint(_monitor.Position),
                PelsWidth = Width,
                PelsHeight = Height,
                BitsPerPel = Bits,
                Fields = DM.PelsHeight | DM.PelsWidth | DM.BitsPerPixel
            };
            User32.ChangeDisplaySettingsEx(_monitor.Name, dm, IntPtr.Zero, ChangeDisplaySettingsEnum.Fullscreen, IntPtr.Zero);
            User32.ShowWindow(_handle, ShowWindowCommand.Show);
            User32.SetForegroundWindow(_handle);
            User32.SetFocus(_handle);
               // User32.ChangeDisplaySettings(dm, ChangeDisplaySettingsEnum.Fullscreen);
            //var rect = new Win32Rectangle { Left = 0, Right = Width, Top = 0, Bottom = Bits };
            //User32.AdjustWindowRectEx(ref rect, style, false, exStyle);
        }
Esempio n. 4
0
 public static extern bool EnumDisplaySettingsEx(string deviceName, int iModeNum, ref DeviceMode lpDevMode, int dwFlags);
Esempio n. 5
0
 public static extern int EnumDisplaySettings(string deviceName, int iModeNum, ref DeviceMode lpDevMode);
Esempio n. 6
0
 public static extern int ChangeDisplaySettingsEx(string deviceName, DeviceMode deviceMode, IntPtr handle, ChangeDisplaySettingsEnum dwflags, IntPtr lParam);
Esempio n. 7
0
 public static extern long ChangeDisplaySettings(DeviceMode lpDevMode, ChangeDisplaySettingsEnum dwflags);