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);
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);