distorted bitmaps and meta's using diff resolutions
-
When I copy and paste bitmaps and pictures from my app to another like WORD, the image seems ok under 1280 by 1024. When I change screen resolutions, try to copy and past again, the pictures get distorted and or clipped here is meta code //------------------------------------------------------------------------------ // Create a meta record for drawing the given component. //------------------------------------------------------------------------------ BOOL ZClipboard::setMetaFile(CRect rect, CDC *dc, ZComponent *c, HWND hWnd) { // Meta file DCs operate in HIMETRIC units, we // must scale the extents to these units so that // the object appears the same size when pasted. double units_per_inch = 25.4 / 0.01 + 0.5; // 25.4 mm at 0.01 mm per unit. double scale = units_per_inch / 96.0; // divide by screen units // Now scale the extents to HIMETRIC units. rect.left = int(rect.left * scale + 0.5); rect.top = int(rect.top * scale + 0.5); rect.right = int(rect.right * scale + 0.5); rect.bottom = int(rect.bottom * scale + 0.5); HENHMETAFILE hMF = NULL; CMetaFileDC metadc; if (metadc.CreateEnhanced(dc, NULL, &rect, NULL)) { metadc.SetAttribDC(dc->m_hDC); // This must be set! // Translate the current window origin // to the context of the component. // Un-translate the current window origin // to the parent coords of the component. { ZGraphics meta_g(&metadc); meta_g -= c->getLocationOnCanvas(); meta_g -= c->getLocation(); c->paintAll(meta_g); } hMF = metadc.CloseEnhanced(); // Close the DC. } else return false; // Open the clipboard. OpenClipboard() takes one // parameter, the handle of the window that will temporarily // be it's owner. If NULL is passed, the current process // is assumed. After opening, empty the clipboard so we // can put our metafile on it. if (hMF) { OpenClipboard(hWnd); EmptyClipboard(); SetClipboardData(CF_ENHMETAFILE,hMF); CloseClipboard(); } return true; } here is bitmap code //------------------------------------------------------------------------------ // Get a snapshot of the screen at the location of the given rectangle //------------------------------------------------------------------------------ BOOL ZClipboard::setBitmap(CRect rect, CDC *dc, HWND