Docs / UI

Glossary: DisplayScale

The members of DisplayScale, in alphabetical order.

Color legend method

Reads the Windows display scale of the monitor a window is on. Without the awareness call, Windows reports 96 DPI.

A static class. The quick start guide shows it in context.

Names are colored by what they are: a property, a method or an event; values and fields keep the plain color.

Fields

DefaultDpi 馃爢

int 路 Static. 96, the DPI of a monitor at 100 %.

Methods

DeclarePerMonitorAwareness() 馃爢

DeclarePerMonitorAwareness() 路 Static. Declares the process per-monitor DPI aware. Call it before the game creates its window. Returns false when Windows doesn鈥檛 accept it: the awareness was declared already, by an application manifest or an earlier call, or Windows is older than Windows 10 1703.

DpiOf() 馃爢

DpiOf(GameWindow window) 路 Static. The DPI of the monitor under the middle of the window鈥檚 client area. 96 when it can鈥檛 be read.

Parameter Type Description
window GameWindow The game window; the monitor under the middle of its client area counts.

DpiOf(Rectangle screenBounds) 路 Static. The same for a rectangle in screen coordinates, using the nearest monitor when none is under it.

Parameter Type Description
screenBounds Rectangle A rectangle in screen coordinates, in device pixels.

ScaleOf() 馃爢

ScaleOf(GameWindow window) 路 Static. The display scale as a UI scale: the DPI divided by 96, so 1.5 at 150 %.

Parameter Type Description
window GameWindow The game window; the monitor under the middle of its client area counts.