Difference between revisions of "DesktopDisplay"

From Xojo Documentation

(Created page with "N/A")
 
 
Line 1: Line 1:
N/A
+
{{ClassBox
 +
| super=[[Object]]
 +
| platform=all
 +
| scope=global
 +
| newinversion=2021r3
 +
}}
 +
{{Description
 +
|text = Used to get information about the connected displays. }}
 +
 
 +
<dynamicTable id="Properties" class="propertyTable" title="Properties" columns="3">
 +
{{Property | name=AvailableHeight | type=Integer | platform=all | readonly=yes | description=( Integer)&nbsp;&nbsp;The available height (in pixels) of the specified display, taking into account the menubar and/or the taskbar (Dock on Mac), if present. }}
 +
{{Property | name=AvailableLeft | type=Integer | platform=all | readonly=yes | description=( Integer)&nbsp;&nbsp;The number of usable pixels from the left edge of the specified display. }}
 +
{{Property | name=AvailableTop | type=Integer | platform=all | readonly=yes | description=( Integer)&nbsp;&nbsp;The number of usable pixels from the top edge of the specified display. }}
 +
{{Property | name=AvailableWidth | type=Integer | platform=all | readonly=yes | description=( Integer)&nbsp;&nbsp;The available width (in pixels) of the display, taking into account the taskbar if placed on the left or right of the specified display. }}
 +
{{Property | name=ColorDepth | type=Integer | platform=all | readonly=yes | description=( Integer)&nbsp;&nbsp;The color depth of the display in pixels. }}
 +
{{Property | name=Height | type=Integer | platform=all | readonly=yes | description=( Integer)&nbsp;&nbsp;The height of the display in pixels. }}
 +
{{Property | name=Left | type=Integer | platform=all | readonly=yes | description=( Integer)&nbsp;&nbsp;The left coordinate of the display relative to the main display. }}
 +
{{Property | name=ScaleFactor | type=Double | platform=all | readonly=yes | description=( Double)&nbsp;&nbsp;The ScaleFactor of the specified display.}}
 +
{{Property | name=Top | type=Integer | platform=all | readonly=yes | description=( Integer)&nbsp;&nbsp;The top coordinate of the display relative to the main display. }}
 +
{{Property | name=Width | type=Integer | platform=all | readonly=yes | description=( Integer)&nbsp;&nbsp;The width of the display. }}
 +
</dynamicTable>
 +
 
 +
<dynamicTable id="Shared Methods" class="methodTable" title="Shared Methods" columns="2">
 +
{{Method | name=DisplayAt | params=index as [[Integer]] | returntype=[[DesktopDisplay]] | description=DisplayAt(index As Integer) as DesktopDisplay&#x0A;Returns a reference to the display index passed.}}
 +
</dynamicTable>
 +
 
 +
<dynamicTable id="Shared Properties" class="propertyTable" title="Shared Properties" columns="3">
 +
{{Property | name=LastDisplayIndex | type=Integer | platform=all | readonly=yes | description=( String)&nbsp;&nbsp;The index of the last display connected to the user's computer. }}
 +
{{Property | name=DisplayCount | type=Integer | platform=all | readonly=yes | description=( String)&nbsp;&nbsp;The number of displays connected to the user's computer. }}
 +
</dynamicTable>
 +
 
 +
==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.
 +
 
 +
<rbcode>
 +
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)
 +
</rbcode>
 +
 
 +
[[Category:Desktop]]
 +
[[Category:Hardware Monitors/Screens]]

Latest revision as of 19:12, 23 July 2021

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)