How to Get Windows Display Settings

How to get Windows Display settings?

This setting is the screen DPI, or dots per inch.

Read it like so:

float dpiX, dpiY;
Graphics graphics = this.CreateGraphics();
dpiX = graphics.DpiX;
dpiY = graphics.DpiY;

I don't think it's possible at the moment for the X and Y values to be different. A value of 96 corresponds to 100% font scaling (smaller), 120 corresponds to 125% scaling (medium) and 144 corresponds to 150% scaling (larger). However, users are able to set values other than these standard ones.

Do be aware that unless your application is declared to be DPI aware, then the values you observe may be subject to DPI virtualization.

obtain Windows 10 Display settings values in Java

Found solution that seems to respect the Display settings.

javafx.geometry.Rectangle2D r = new javafx.geometry.Rectangle2D(0, 0, 1, 1);
ObservableList<Screen> screens = Screen.getScreensForRectangle(r);
if (screens != null && screens.size() > 0) {
javafx.geometry.Rectangle2D rc = screens.get(0).getBounds();
}


Related Topics



Leave a reply



Submit