Chapter 9 Strings Visual C++ and MFC Fundamentals
// Horizontal axis
pDC->MoveTo(-320, 0);
pDC->LineTo( 320, 0);
// Vertical axis
pDC->MoveTo( 0, -220);
pDC->LineTo( 0, 220);
// An orange pen
CPen PenGreen(PS_SOLID, 1, RGB(64, 128, 128));
pOld = pDC->SelectObject(&PenGreen);
// A diagonal line at 45 degrees
pDC->MoveTo(0, 0);
pDC->LineTo(120, 120);
pDC->SelectObject(pOld);
}
As you can see, our line is not at 45º. Instead of being in the first quadrant, it is in the
fourth. This is due to the default orientation of the coordinate system.
8.2 The Mapping Modes....................................................................................
8.2.1 Mapping Mode Choices......................................................................
To control the orientation of the axes of the device context, you use a member function
of the CDC class called SetMapMode(). Its syntax is:
int SetMapMode(int nMapMode);
As you are about to see, this member function can be used to do two things, depending on
the value of the argument. It can control the orientation of the coordinate system you