Skip to content

Instantly share code, notes, and snippets.

@sergey-shambir
Created March 24, 2016 08:23
Show Gist options
  • Save sergey-shambir/62b37c18fe3d60a08494 to your computer and use it in GitHub Desktop.
Save sergey-shambir/62b37c18fe3d60a08494 to your computer and use it in GitHub Desktop.
// pixels to dialog units
{
WTL::CDialogBaseUnits units(GetFont(), m_hWnd);
WTL::CSize size = units.MapDialogPixels(WTL::CSize(800, 520));
wchar_t buffer[2000];
wsprintf(buffer, L"%dx%d", size.cx, size.cy);
MessageBoxW(buffer, L"SIZE", MB_OK);
}
// map dialog units to pixels
{
WTL::CDialogBaseUnits units(GetFont(), m_hWnd);
WTL::CSize size = units.MapDialogUnits(WTL::CSize(800, 520));
wchar_t buffer[2000];
wsprintf(buffer, L"%dx%d", size.cx, size.cy);
MessageBoxW(buffer, L"SIZE", MB_OK);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment