X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d1ae263893419a87f0e7a67bbcbaf86c350ffdfe..198be845897a79ba350ae7f93db536ddb2eccfb2:/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;