| Did you read the documentation on the two classes? It seemed
pretty clear to me.
You use CPaintDC in code which is handling a WM_PAINT message;
usually in your OnPaint message-handling function. CPaintDC
automatically calls BeginPaint and EndPaint (in the class'
constructor and destructor, respectively). If you're using
the MFC doc/view architecture, and have overridden OnDraw,
OnDraw gets passed a CPaintDC which is all ready to be painted
into by your OnDraw function.
CClientDC encapsulates a device context which represents the
client area of a window. You'd use CClientDC when your code
needs to draw in a window in "real time" (without waiting for
a WM_PAINT) - for example, when drawing a "rubber band" line
in response to mouse movement in the view. CClientDC calls
GetDC and ReleaseDC (at construction and destruction).
|