From 0e38c1d31f22e4ea63ff7f8d6428b1ac97d97180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Wed, 29 May 2024 13:19:50 +0800 Subject: [PATCH] issues/773 --- LunaTranslator/LunaTranslator/myutils/hwnd.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LunaTranslator/LunaTranslator/myutils/hwnd.py b/LunaTranslator/LunaTranslator/myutils/hwnd.py index 48d508ba..2821e2b1 100644 --- a/LunaTranslator/LunaTranslator/myutils/hwnd.py +++ b/LunaTranslator/LunaTranslator/myutils/hwnd.py @@ -232,6 +232,11 @@ def mouseselectwindow(callback): def screenshot(x1, y1, x2, y2, hwnd=None): + if hwnd: + rate = QApplication.instance().devicePixelRatio() / ( + windows.GetDpiForWindow(hwnd) / 96 + ) + x1, y1, x2, y2 = (int(_ / rate) for _ in (x1, y1, x2, y2)) bs = winsharedutils.gdi_screenshot(x1, y1, x2, y2, hwnd) pixmap = QPixmap() if bs: