WindowGetDpiY

Syntax

DpiY.d = WindowGetDpiY(Window)

Description

Retrieves the current vertical Dots Per Inch (DPI) setting for the monitor the specified window is currently on.

Parameters

Window
The handle of the ProGUI window whose vertical DPI is to be retrieved.

Return Value

Returns the vertical DPI value as a floating-point number (Double). Returns 0.0 or #False if the window handle is invalid.

Remarks

The standard DPI is typically 96. Higher values indicate higher display scaling. This value can change if the window is moved to a different monitor with different DPI settings. Use the #PG_Event_DPI event to react to such changes. Typically, the horizontal and vertical DPI values are the same.

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

MyWindow = CreateWindow(0, 0, 300, 200, "DPI Info")

If MyWindow
  WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)

  DpiX.d = WindowGetDpiX(MyWindow)
  DpiY.d = WindowGetDpiY(MyWindow)
  Debug "Window DPI X: " + StrD(DpiX)
  Debug "Window DPI Y: " + StrD(DpiY)

  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf

StopProGUI()

See Also

WindowGetDpiX, WindowGetDpiScaleX, WindowGetDpiScaleY, #PG_Event_DPI

Supported OS

Windows, Linux