A utility class that provides methods to retrieve information about display monitors in a multi-monitor setup. This includes details such as monitor name, resolution, work area, and whether a monitor is the primary display.
GetMonitorInfo
Retrieves a list of all available monitors and their details.
1 | List<DisplayMonitorDetails> monitors = DisplayMonitorHelper.GetMonitorInfo(); |
GetMonitorInfo(IntPtr hwnd) / GetMonitorInfo(Window? window)
Retrieves information about the monitor closest to the specified window or window handle (hwnd).
1 | List<DisplayMonitorDetails> monitors = DisplayMonitorHelper.GetMonitorInfo(hwnd); |
GetPrimaryMonitorInfo
Retrieves information about the primary monitor (the main display)
1 | DisplayMonitorDetails primaryMonitor = DisplayMonitorHelper.GetPrimaryMonitorInfo(); |
Demo
you can run demo and see this feature.