public static bool TryGetDisplayInfo(this Window window, DefaultWindow defaultWindow, [System.Diagnostics.CodeAnalysis.MaybeNullWhen(true)] out DisplayDevice displayDevice) #endif { displayDevice = default; if (window.TryGetMonitorInfo(defaultWindow, out MonitorInfo monitorInfo)) { displayDevice.Init(); return(NativeMethods.EnumDisplayDevices(monitorInfo.DeviceName, 0, ref displayDevice, 1)); } return(false); }
/// <summary> /// Obtain information on a display monitor associated with this window. /// </summary> /// <param name="window">Window of interest.</param> /// <param name="defaultWindow">Determines the function's return value if the window does not intersect any display monitor.</param> /// <param name="displayDevice">Display information for selected display.</param> /// <returns>Information about the display device.</returns> /// <exception cref="COMException">Win32 error.</exception> #if NET451 public static bool TryGetDisplayInfo(this Window window, DefaultWindow defaultWindow, out DisplayDevice displayDevice)