Syntax
DpiX.d = WindowGetDpiX(Window)
Description
Retrieves the current horizontal Dots Per Inch (DPI) setting for the monitor the specified window is currently on.
Parameters
Window
The handle of the ProGUI window whose horizontal DPI is to be retrieved.
Return Value
Returns the horizontal 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.
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
WindowGetDpiY, WindowGetDpiScaleX, WindowGetDpiScaleY, #PG_Event_DPI
Supported OS
Windows, Linux