void wxEnhMetaFileDCImpl::Create(HDC hdcRef, const wxString& filename, int width, int height, const wxString& description) { m_width = width; m_height = height; RECT rect; RECT *pRect; if ( width && height ) { rect.top = rect.left = 0; rect.right = width; rect.bottom = height; // CreateEnhMetaFile() wants them in HIMETRIC PixelToHIMETRIC(&rect.right, &rect.bottom, hdcRef); pRect = ▭ } else { // GDI will try to find out the size for us (not recommended) pRect = (LPRECT)NULL; } m_hDC = (WXHDC)::CreateEnhMetaFile(hdcRef, GetMetaFileName(filename), pRect, description.wx_str()); if ( !m_hDC ) { wxLogLastError(wxT("CreateEnhMetaFile")); } }
void wxEnhMetaFile::Assign(const wxEnhMetaFile& mf) { if ( &mf == this ) return; if ( mf.m_hMF ) { m_hMF = (WXHANDLE)::CopyEnhMetaFile(GetEMFOf(mf), GetMetaFileName(m_filename)); if ( !m_hMF ) { wxLogLastError(_T("CopyEnhMetaFile")); } } else { m_hMF = 0; } }