diff options
author | RadAd <adamgates84+github@gmail.com> | 2021-07-07 10:18:08 +1000 |
---|---|---|
committer | RadAd <adamgates84+github@gmail.com> | 2021-07-07 10:18:08 +1000 |
commit | e2af50ed3ecbc29c56a211411bcbb666031080ff (patch) | |
tree | 91d9adba15a4345e8569924b717152195bf55a9a /WinUtils.h | |
parent | fa32e0c6d33792861fa4a7fac83f5bf987d1ac3d (diff) | |
download | RadTerminal-e2af50ed3ecbc29c56a211411bcbb666031080ff.tar.gz RadTerminal-e2af50ed3ecbc29c56a211411bcbb666031080ff.zip |
Added support for per monitor dpi
Diffstat (limited to 'WinUtils.h')
-rw-r--r-- | WinUtils.h | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -49,6 +49,25 @@ inline BOOL UnadjustWindowRectEx( return fRc; } +inline BOOL UnadjustWindowRectExForDpi( + LPRECT prc, + DWORD dwStyle, + BOOL fMenu, + DWORD dwExStyle, + UINT dpi) +{ + RECT rc; + SetRectEmpty(&rc); + BOOL fRc = AdjustWindowRectExForDpi(&rc, dwStyle, fMenu, dwExStyle, dpi); + if (fRc) { + prc->left -= rc.left; + prc->top -= rc.top; + prc->right -= rc.right; + prc->bottom -= rc.bottom; + } + return fRc; +} + inline RECT Rect(POINT p1, POINT p2) { return { p1.x, p1.y, p2.x, p2.y }; @@ -63,7 +82,7 @@ inline HFONT CreateFont(LPCTSTR pFontFace, int iFontHeight, int cWeight, BOOL bI { return CreateFont(iFontHeight, 0, 0, 0, cWeight, bItalic, bUnderline, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, - DEFAULT_PITCH | FF_DONTCARE, pFontFace); + FIXED_PITCH | FF_DONTCARE, pFontFace); } inline std::string RegGetString(HKEY hKey, LPCSTR sValue, const std::string& strDef) |