DesktopDisplay

From Xojo Documentation

Class (inherits from Object)


New in 2021r3

Used to get information about the connected displays.

Properties
AvailableHeight fa-lock-32.png ColorDepth fa-lock-32.png Top fa-lock-32.png
AvailableLeft fa-lock-32.png Height fa-lock-32.png Width fa-lock-32.png
AvailableTop fa-lock-32.png Left fa-lock-32.png
AvailableWidth fa-lock-32.png ScaleFactor fa-lock-32.png
Shared Methods
DisplayAt
Shared Properties
DisplayCount fa-lock-32.png LastDisplayIndex fa-lock-32.png

Notes

Although you cannot create an object of type DesktopDisplay, you can access display objects through the DesktopDisplay class.

Sample Code

The following reports on the values of AvailableLeft, AvailableHeight, AvailableTop, and AvailableWidth for the main display. The value of AvailableHeight takes into account the height of the taskbar (Windows and Linux) and the Dock (macOS). If the user has these tools configured to display on the side, the AvailableWidth property takes them into account.

Var s As String
s = "Left=" + DesktopDisplay.DisplayAt(0).AvailableLeft.ToString + EndOfLine
s = s + "Width=" + DesktopDisplay.DisplayAt(0).AvailableWidth.ToString + EndOfLine
s = s + "Top=" + DesktopDisplay.DisplayAt(0).AvailableTop.ToString + EndOfLine
s = s + "Height=" + DesktopDisplay.DisplayAt(0).AvailableHeight.ToString + EndOfLine
MessageBox(s)