User Tools

Site Tools


k15:k15.8:start

15.8 Class Screen (gb. qt4)

The Screen class describes the physical dimensions (geometry) of the selected monitor connected to your graphics card in the system. If you use more than one monitor, you should use the class Screens (gb.qt4). The class Screen has no methods and events.

The properties of the class - all of the integer type - are listed and described in the following table:

tablelayout

PropertyDescription
AvailableHeightSpecifies the height of the usable desktop on a monitor in pixels. The usable desktop rectangle is the screen area minus all stationary desktop panels.
AvailableWidthSpecifies the width of the usable desktop on a monitor. The usable desktop rectangle is the screen area minus all stationary desktop panels.
Height or HSpecifies the height of the screen relative to the entire virtual desktop.
Width or WSpecifies the width of the screen relative to the entire virtual desktop.
AvailableXIndicates the left X coordinate of the usable desktop on the monitor.
AvailableYIndicates the upper Y coordinate of the usable desktop on the monitor.
XIndicates the left X coordinate of the screen relative to the entire virtual desktop.
YIndicates the upper Y coordinate of the screen relative to the entire virtual desktop.

Table 15.8.1: Overview of selected properties of the class Screen (gb.qt4)

This class can be used as an object by creating and using a hidden instance if required.

For example, you can call certain properties for the standard monitor (index = 0) and display them in a message box. To do this you use 3 different classes:

Public Sub btnGetMonitorGeometry_Click()
 
  Dim sMessage As String
 
  sMessage = "<hr><b>Monitor-Eigenschaften</b><hr>"
  sMessage &= "Monitor-Höhe = " & Screen.Height & " Pixel"
  sMessage &= "<br>Monitor-Breite = " & Screen.Width & " Pixel"
  sMessage &= "<br>Auflösung = " & Desktop.Resolution & " DPI <hr>"
  sMessage &= "Nutzbare Desktop-Höhe = " & Screens[0].AvailableHeight & " Pixel"
  sMessage &= "<br>Nutzbare Desktop-Breite = " & Screens[0].AvailableWidth & " Pixel<br>"
 
  Message.Info(sMessage)  
 
End

Monitor

Figure 15.8.1: Monitor properties

The difference in height between monitor height and usable desktop height of 48 pixels is shown by the author, for example in Ubuntu 12.04 (LTS) as the difference between the monitor height of 1050 pixels and the heights of the two panels (up and down) with 24 pixels each. The property Resolution of the class Desktop (gb.qt4) returns the resolution in DPI (Dots Per Inch).

Download

15.8 Klasse Screen (gb.qt4)

Die Klasse Screen beschreibt die physischen Maße (Geometrie) des ausgewählten Monitors, der mit Ihrer Grafikkarte im System verbunden ist. Benutzen Sie mehrere Monitore, dann sollten Sie die Klasse Screens (gb.qt4) einsetzen. Die Klasse Screen besitzt keine Methoden und Ereignisse (Events).

Die Eigenschaften der Klasse – alle vom Typ Integer – werden in der folgenden Tabelle aufgeführt und beschrieben:

EigenschaftBeschreibung
.AvailableHeight Gibt die Höhe des nutzbaren Desktop auf einem Monitor in Pixeln an. Das nutzbare Desktop-Rechteck ist die Bildschirmfläche vermindert um alle stationären Desktop-Panels.
AvailableWidthGibt die Breite des nutzbaren Desktop auf einem Monitor an. Das nutzbare Desktop-Rechteck ist die Bildschirmfläche vermindert um alle stationären Desktop-Panels.
Height oder .HGibt die Höhe des Bildschirms relativ zum gesamten virtuellen Desktop an.
Width oder .WGibt die Breite des Bildschirms relativ zum gesamten virtuellen Desktop an.
AvailableXGibt die linke X-Koordinate des nutzbaren Desktop auf dem Monitor an.
AvailableYGibt die obere Y-Koordinate des nutzbaren Desktop auf dem Monitor an.
XGibt die linke X-Koordinate des Bildschirms relativ zum gesamten virtuellen Desktop an.
YGibt die obere Y-Koordinate des Bildschirms relativ zum gesamten virtuellen Desktop an.

Tabelle 15.8.1: Übersicht zu ausgewählten Eigenschaften der Klasse Screen (gb.qt4)

Diese Klasse kann als Objekt benutzt werden, indem man bei Bedarf eine versteckte Instanz erstellt und nutzt.

So können Sie zum Beispiel für den Standard-Monitor (Index = 0) bestimmte Eigenschaften abrufen und in einer Message-Box anzeigen lassen. Dafür nutzen Sie hier 3 unterschiedliche Klassen:

Public Sub btnGetMonitorGeometry_Click()
 Dim sMessage As String
 
  sMessage = "<hr><b>Monitor-Eigenschaften</b><hr>"
  sMessage &= "Monitor-Höhe = " & Screen.Height & " Pixel"
  sMessage &= "<br>Monitor-Breite = " & Screen.Width & " Pixel"
  sMessage &= "<br>Auflösung = " & Desktop.Resolution & " DPI <hr>"
  sMessage &= "Nutzbare Desktop-Höhe = " & Screens[0].AvailableHeight & " Pixel"
  sMessage &= "<br>Nutzbare Desktop-Breite = " & Screens[0].AvailableWidth & " Pixel<br>"
  Message.Info(sMessage)  
End ' btnGetMonitorGeometry_Click()

Monitor

Abbildung 15.8.1: Monitoreigenschaften

Der Unterschied in der Höhe zwischen Monitor-Höhe und nutzbarer Desktop-Höhe von 48 Pixel ergibt sich beim Autor zum Beispiel bei Ubuntu 12.04 (LTS) als Differenz zwischen der Monitorhöhe 1050 Pixel und den Höhen der beiden Panele (oben und unten) mit jeweils 24 Pixel. Die Eigenschaft .Resolution der Klasse Desktop (gb.qt4) liefert die Auflösung (Resolution) in DPI (Dots Per Inch).

Download

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k15/k15.8/start.txt · Last modified: 02.07.2018 (external edit)

Page Tools