Syntax
ScaleY.d = WindowGetDpiScaleY(Window)
Description
Retrieves the current vertical DPI scaling factor for the specified window. This factor represents the ratio of the window's current vertical DPI to the default system DPI (usually 96 DPI). For example, on a display set to 150% scaling (144 DPI), this function would return 1.5 (144 / 96).
Parameters
Window
The handle of the ProGUI window whose DPI scale factor is to be retrieved.
Return Value
Returns the vertical DPI scaling factor as a floating-point number (Double). Returns 0.0 or #False if the window handle is invalid.
Remarks
This value is crucial when performing manual calculations that need to account for display scaling, or when converting between DIPs and physical pixels. The scaling factor can change if the window is moved to a monitor with a different DPI setting. Listen for the #PG_Event_DPI event to detect such changes. Typically, the horizontal and vertical scaling factors are the same.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
MyWindow = CreateWindow(0, 0, 300, 200, "DPI Scale Info")
If MyWindow
WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)
ScaleX.d = WindowGetDpiScaleX(MyWindow)
ScaleY.d = WindowGetDpiScaleY(MyWindow)
Debug "Window DPI Scale X: " + StrD(ScaleX)
Debug "Window DPI Scale Y: " + StrD(ScaleY)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()
See Also
WindowGetDpiScaleX, WindowGetDpiX, WindowGetDpiY, #PG_Event_DPI
Supported OS
Windows, Linux