Skip to content

Commit

Permalink
use system dpi for langbar icon
Browse files Browse the repository at this point in the history
dinhngtu committed May 16, 2023
1 parent cd0c05d commit 493767f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions VietTypeATL/LanguageBarHandlers.cpp
Original file line number Diff line number Diff line change
@@ -79,8 +79,11 @@ HRESULT RefreshableButton::GetIcon(__RPC__deref_out_opt HICON* hicon) {
}

DWORD light = GetSystemLightTheme();
int iconx = GetSystemMetrics(SM_CXSMICON);
int icony = GetSystemMetrics(SM_CYSMICON);
auto old = SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
auto dpi = GetDpiForSystem();
int iconx = GetSystemMetricsForDpi(SM_CXSMICON, dpi);
int icony = GetSystemMetricsForDpi(SM_CYSMICON, dpi);
SetThreadDpiAwarenessContext(old);
if (_controller->GetBlocked() == EngineController::BlockedKind::Blocked) {
*hicon = static_cast<HICON>(LoadImage(
Globals::DllInstance, MAKEINTRESOURCE(light ? IDI_ICONXL : IDI_ICONXD), IMAGE_ICON, iconx, icony, 0));

0 comments on commit 493767f

Please sign in to comment.