Ghost1372

everything can be handy

DisplayMonitorHelper

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
2
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
2
3
List<DisplayMonitorDetails> monitors = DisplayMonitorHelper.GetMonitorInfo(hwnd);
// OR
List<DisplayMonitorDetails> monitors = DisplayMonitorHelper.GetMonitorInfo(window);

GetPrimaryMonitorInfo

Retrieves information about the primary monitor (the main display)

1
DisplayMonitorDetails primaryMonitor = DisplayMonitorHelper.GetPrimaryMonitorInfo();

Demo

you can run demo and see this feature.

0%