I'm sure all this sounds like very basic stuff, but I'm confused.
Thanks,
Fred
Every window receives WM_PAINT when Windows determines that it needs
repainting, such as when it is unminimized or another window uncovers
any part of it. You must (re)paint all custom graphics in your window
when this message happens, otherwise your window will not reappear
correctly. In most MFC window classes the OnPaint message handler
function is where you do the painting. Only CView-derived classes have
an OnDraw function. It is simply called by OnPaint to do the drawing.
This provides a design option to call OnDraw in other contexts as well,
such as for painting to a printer.
If the CFileDialog image does not go away it probably means you did not
(re)paint your window in response to WM_PAINT. If your window is
CView-derived do it in OnDraw.
Invalidate is used when you want to force a window to repaint, such as
when the data it renders has changed. Invalidate asks Windows to send
WM_PAINT to the specified window.
Play with the SCRIBBLE tutorial in MSDN to get more familiar with these
issues.
--
Scott McPhillips [VC++ MVP]
When I was originally struggling with these issues I happened across
books from Wrox Press, Ltd. In particular I would recommend "Beginning
Visual C++ 6" by Ivor Horton, ISBN: 1-861000-88-X. It is a $50 book in
the stores (Barnes & Noble or Border's), probably cheaper via Amazon.
Horton will walk you through enough of the MFC issues, like OnDraw() and
OnPaint(), that will allow you to subsequently synthesize your own
programs and not be surprised by the outcome.
Thomas