User-80781307 posted
Hello...
I have a question about custom units of measurement. I want to use GDI+ because I will have to draw vector objects and plain old GDI won't cut it. I am writing software for hardware which basically uses measurements that aren't typical (the
measurements are 5000/12 == 1 inch). So, is there a way to use SetPageUnit() to use my custom measurement? If not, how would I accomplish this? This code works for me, but it's GDI, not GDI+:
static const float INCH = 5000.0f/12.0f;
CRect rc;
GetClientRect(&rc);
dc.SetMapMode(MM_ISOTROPIC);
dc.SetViewportOrg(0, 0);
dc.SetWindowExt(INCH*12, INCH*12);
dc.SetViewportExt(rc.Width(), rc.Height());
dc.TextOut(INCH*2,INCH*5,"Hello World");
This would draw "Hello World" at 2",5" perfectly. I noticed that if i run this code, then attach a Graphics object to the CDC it keeps the units, but i don't know if that is the proper way to do this in GDI+, which is why i am here!
Thanks for any tips!
-andy.