The CPaintDC
class encapsulates the calls to the BeginPaint and
EndPaint in its constructor and destructor. This class is
designed to be used when responding to WM_PAINT messages.
Note that
most applications do not need to create a CPaintDC object
directly. The default implementation of the Cview::OnPaint
member function creates such a device context and passes
it to the class's OnDraw member function (which is usually
overridden to provide application-specific drawing of a
view).
VC++, MFC, Source Code, Tutorial,
free Example download