Click to See Complete Forum and Search --> : GDI+ metafile problem


pdehon
October 18th, 2004, 02:25 AM
In the following source code fragment a metafile is generated with a line with a length of 60 millimeter using GDI+. The problem is when I analyse this metafile with Visio or print 1:1 on paper, the dimension of the line is not 60 mm ! I hope somebody can tell me the reason.

Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;

GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

Metafile* myMetafile = new Metafile(L"MyDiskFile.emf", ::GetDC(NULL));
Graphics* myGraphics = new Graphics(myMetafile);
Pen* myPen = new Pen(Color(255, 0, 0, 200));

myGraphics->SetPageUnit(UnitMillimeter);

myGraphics->DrawLine(myPen, 0, 0, 60, 0);
delete myGraphics;
delete myPen;
delete myMetafile;

GdiplusShutdown(gdiplusToken);

kirants
October 18th, 2004, 06:48 PM
I ain't so sure. But, do you have to also set the mapping mode onto the dc so that that info also goes to metafile ?