The
CClientDC class is used to create a device context object
corresponding to the client area of a given window. The
constructor and destructor of CClientDC encapsulate calls
to the GetDC and ReleaseDC functions.
CClientDC objects
are most often used when drawing into a device context is
required outside an OnDraw function.
A particular
use of CClientDC objects concerns mapping modes.
Sometimes, it is necessary for an application to translate
logical coordinates into physical coordinates or vice
versa even when no actual drawing is performed. In these
situations, it is a frequently used practice to create a
CClientDC object for the sole purpose of being able to use
one of its coordinate transformation functions. For
example:
CClientDC dc(myView);
myView->OnPrepareDC(&dc);
dc.LPtoDP(&point);
VC++ MFC Tutorial, Free Source Code Download