X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/802e382ff1f4e700a7fafd5c8a400668c5959bbf..9d5507f7a2701395e1d5c121bd877bb9066ee6ea:/src/msw/metafile.cpp diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index 29c08d30f2..2186f3ef18 100644 --- a/src/msw/metafile.cpp +++ b/src/msw/metafile.cpp @@ -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;