private ChangeDisplaySettingsEx ( [ lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, ChangeDisplaySettingsEnum dwflags, LPVOID lParam ) : LONG | ||
lpszDeviceName | [ | |
lpDevMode | LPDEVMODE | |
hwnd | HWND | |
dwflags | ChangeDisplaySettingsEnum | |
lParam | LPVOID | |
return | LONG |
public override sealed bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution) { DeviceMode lpDevMode = (DeviceMode)null; if (resolution != (DisplayResolution)null) { lpDevMode = new DeviceMode(); lpDevMode.PelsWidth = resolution.Width; lpDevMode.PelsHeight = resolution.Height; lpDevMode.BitsPerPel = resolution.BitsPerPixel; lpDevMode.DisplayFrequency = (int)resolution.RefreshRate; lpDevMode.Fields = 6029312; } return(0 == Functions.ChangeDisplaySettingsEx((string)device.Id, lpDevMode, IntPtr.Zero, ChangeDisplaySettingsEnum.Fullscreen, IntPtr.Zero)); }
public bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution) { DeviceMode mode = null; if (resolution != null) { mode = new DeviceMode(); mode.PelsWidth = resolution.Width; mode.PelsHeight = resolution.Height; mode.BitsPerPel = resolution.BitsPerPixel; mode.DisplayFrequency = (int)resolution.RefreshRate; mode.Fields = Constants.DM_BITSPERPEL | Constants.DM_PELSWIDTH | Constants.DM_PELSHEIGHT | Constants.DM_DISPLAYFREQUENCY; } return(Constants.DISP_CHANGE_SUCCESSFUL == Functions.ChangeDisplaySettingsEx(available_device_names[device], mode, IntPtr.Zero, ChangeDisplaySettingsEnum.Fullscreen, IntPtr.Zero)); }