]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/metafile.cpp
correction to last commit: don't test unsetenv() return value, it's void under Darwin
[wxWidgets.git] / src / msw / metafile.cpp
index 29c08d30f2aa5b71c3bb98bcb727baa7aac1ee1d..2186f3ef18e5d9573aea35645638bdc04b12380f 100644 (file)
@@ -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;