X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d1ae263893419a87f0e7a67bbcbaf86c350ffdfe..9d5507f7a2701395e1d5c121bd877bb9066ee6ea:/src/msw/metafile.cpp diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index cca6815690..2186f3ef18 100644 --- a/src/msw/metafile.cpp +++ b/src/msw/metafile.cpp @@ -191,7 +191,7 @@ wxMetafileDC::wxMetafileDC(const wxString& file, int xext, int yext, int xorg, i m_maxY = -10000; if ( !file.empty() && wxFileExists(file) ) wxRemoveFile(file); - m_hDC = (WXHDC) CreateMetaFile(file.empty() ? NULL : file.c_str()); + m_hDC = (WXHDC) CreateMetaFile(file.empty() ? NULL : file.wx_str()); m_ok = true; @@ -218,14 +218,13 @@ void wxMetafileDC::DoGetTextExtent(const wxString& string, if (!fontToUse) fontToUse = &m_font; - HDC dc = GetDC(NULL); + ScreenHDC dc; + SelectInHDC selFont(dc, GetHfontOf(*fontToUse)); SIZE sizeRect; TEXTMETRIC tm; ::GetTextExtentPoint32(dc, WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect); - GetTextMetrics(dc, &tm); - - ReleaseDC(NULL, dc); + ::GetTextMetrics(dc, &tm); if ( x ) *x = sizeRect.cx;