diff options
Diffstat (limited to 'alf/alfedit.cpp')
| -rw-r--r-- | alf/alfedit.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/alf/alfedit.cpp b/alf/alfedit.cpp index c6570e4..be06b01 100644 --- a/alf/alfedit.cpp +++ b/alf/alfedit.cpp @@ -11,28 +11,26 @@ ALF__EditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_P HDC hDc = GetDC(hwnd); HFONT font = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); - if (font) { - HFONT oldfont = SelectFont(hDc, font); - - TEXTMETRIC tm; - ZeroMemory(&tm, sizeof(tm)); - - if (GetTextMetrics(hDc, &tm)) { - SIZE *ps = (SIZE*)lParam; - if (!ps->cx) { - ps->cx = ALF_CentipointsToPixels(GetParent(hwnd), 12000); - } - - if (!ps->cy) { - ps->cy = tm.tmHeight + 2*ALF_Compat_GetSystemMetricsForDpi( - SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) - + 4 /* padding internal to the edit control */; - } + HFONT oldfont = SelectFont(hDc, font); + + TEXTMETRIC tm; + ZeroMemory(&tm, sizeof(tm)); + + if (GetTextMetrics(hDc, &tm)) { + SIZE *ps = (SIZE*)lParam; + if (!ps->cx) { + ps->cx = ALF_CentipointsToPixels(GetParent(hwnd), 12000); } - SelectFont(hDc, oldfont); + if (!ps->cy) { + ps->cy = tm.tmHeight + 2*ALF_Compat_GetSystemMetricsForDpi( + SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) + + 4 /* padding internal to the edit control */; + } } + SelectFont(hDc, oldfont); + ReleaseDC(hwnd, hDc); return 0; } else if (uMsg == ALF_WM_APPLYSIZE) { |
