Visual C++ and MFC Fundamentals Chapter 9: Strings
want to use for your application. It also helps with the unit system you would prefer to
use.
The argument of this member function is a constant integer that species the mapping
mode used. The possible values are MM_TEXT, MM_LOENGLISH, MM_HIENGLISH,
MM_ANISOTROPIC, MM_HIMETRIC, MM_ISOTROPIC, MM_LOMETRIC, and
MM_TWIPS.
The default map mode used is the MM_TEXT. In other words, if you do not specify
another, this is the one your application would use. With this map mode, the dimensions
or measurements you specify in your CDC member functions are respected and kept "as
is". Also, the axes are oriented so the horizontal axis moves from (0, 0) to the right and
the vertical axis moves from (0, 0) down. For example, the above OnDraw() method can
be re-written as follows and produce the same result:
void CExoView::OnDraw(CDC* pDC)
{
CExoDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->SetMapMode(MM_TEXT);
pDC->SetViewportOrg(220, 150);
// Use a red pen
CPen PenRed(PS_SOLID, 1, RGB(255, 0, 0));
CPen *pOld = pDC->SelectObject(&PenRed);
... No Change
pDC->SelectObject(pOld);
}
The MM_LOENGLISH, like some of the other mapping modes (excluding MM_TEXT
as seen above), performs two actions. It changes the orientation of the vertical axis: the
positive y axis would move from (0, 0) up:
Also, each unit of measure is multiplied by 0.01 inch, which means that each unit you
provide is divided by 100 (unit/100). This also means that the units are reduced from their
stated measures by a 100th. Observe the effect of the MM_LOENGLISH map mode on
the above OnPaint() event :
void CExoView::OnDraw(CDC* pDC)
{
CExoDoc* pDoc = GetDocument();