Answer the question
In order to leave comments, you need to log in
How to make application scaling high dpi?
In my MFC application, I'm trying to expand a dialog box to full screen, but it expands to more than full screen. If on my laptop (win7) it is still possible to configure, then on a high dpi monitor, it generally turns out to be an orgy. Unfortunately, I can't test on a high dpi monitor. so I want to know what I'm doing wrong.
There is the following method for scaling, but it seems to be useless.
HDC screen = ::GetDC(0);
giDpi = GetDeviceCaps(screen, LOGPIXELSX);
int dpiScale(const int &iSrc)
{
return MulDiv(iSrc, giDpi, 96);
}
CRect rect;
GetParent()->GetWindowRect(&rect);
SetWindowPos(NULL, 0, 0, rect.Width() - dpiScale(100), rect.Height() - dpiScale(100), SWP_NOREDRAW);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question