gpt4 book ai didi

Java - 获取 Windows 缩放百分比

转载 作者:行者123 更新时间:2023-12-01 19:47:21 24 4
gpt4 key购买 nike

我需要弄清楚缩放比例设置为多少。这个答案在Windows scaling给出了 c/c++/c# 中的代码,但我需要 Java 中的代码,并且更愿意不必执行 JNI。有没有办法使用 JNA 来获取该信息?

最佳答案

这似乎可以做到:

GraphicsConfiguration asdf = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();

AffineTransform asfd2 = asdf.getDefaultTransform();

double scaleX = asfd2.getScaleX();
double scaleY = asfd2.getScaleY();

请原谅错误的变量名称。您可能想要考虑多个显示器,而不是默认值。但这显示了如何做到这一点。

关于Java - 获取 Windows 缩放百分比,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52684118/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com