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