CLOSE SEARCH

LOGFONT.lfHeight <-> int 상호 변환

int IntToLogFontHeight(int nVal)

{
HDC hdc = ::GetDC(::GetDesktopWindow());
int yPixelPerInch = ::GetDeviceCaps(hdc, LOGPIXELSY);
::ReleaseDC(::GetDesktopWindow(), hdc);
int ret = -1 * (nVal * yPixelPerInch / 72);
return ret;
}
int LogFontHeightToInt(int nVal)
{
HDC hdc = ::GetDC(::GetDesktopWindow());
int yPixelPerInch = ::GetDeviceCaps(hdc, LOGPIXELSY);
::ReleaseDC(::GetDesktopWindow(), hdc);
int ret = int(abs(nVal * 72.0 / yPixelPerInch) + 0.5);
return ret;
}


Filed under: Windows & Windows Phone