Re: Best way to create graphical window inside a dialog?
- From: "Chris Becke" <chris.becke@xxxxxxxxx>
- Date: Fri, 25 Aug 2006 12:09:27 +0200
If you are doing any kind of animation then painting off of WM_PAINT is
potentially problematic. WM_PAINT messages are low priority all things
considered, so there is potentially a lot of latency between doing an
InvalidateRect and actually getting your paint message.
Also, because you are painting what you describe as a tilemap, you dont want
to paint directly to the dialogs DC anyway. PAinting to a screen DC reflects
the changes instantly, so you you have any overlapping at all, the users
will see the scene get progressivly built up.
You need to create an offscreen bitmap, do your painting to that, and paint
that whenever it changes.
With an offscreen bitmap in hand, you can then paint to that in response to
a timer / whenever your tilemap changes, and blit that to the screen, or,
when and if WM_PAINT messages do come through - due to user interactions -
you can paint it again there too.
The painting problems you had when resizing is this: Windows dialog controls
do not support being overlapped. They will end up drawing over each other
and as a result not painting properly as the overlapped painting isn't
detected as a reason to invalidate and repaint.
your most recent painting problems are the sort of thing I experience when I
accidentally treat my DialogProc as a WindowProc. DialogProc *must* return
FALSE for all messages that you dont handle yourself. You MUST NOT call
DefWindowProc (or any kind of API Def* proc) from a DialogProc. That is done
automatically by you returning FALSE.
"DrDerekDoctors" <graham@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1156499034.034564.172560@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Mihai N. wrote:
As for the picture control thing, though, I'll give that a whizz but IYou don't need to get the dialog to repain itself.
suspect I'll still have problems with my inability to get my dialog to
repaint itself at my command.
In fact, you should never care about that.
You should care about the controls repainting, yes.
Are you trying a plain vanila Win32, or MFC?
Plain vanilla Win32. Sorry, what I meant was getting the controls to
repaint, but even so - they don't seem to want to. Unless I can do it
outside of the WM_PAINT message but I read that you really shouldn't do
that.
Graham
.
- Follow-Ups:
- Re: Best way to create graphical window inside a dialog?
- From: DrDerekDoctors
- Re: Best way to create graphical window inside a dialog?
- References:
- Best way to create graphical window inside a dialog?
- From: DrDerekDoctors
- Re: Best way to create graphical window inside a dialog?
- From: Chris Becke
- Re: Best way to create graphical window inside a dialog?
- From: Mihai N.
- Re: Best way to create graphical window inside a dialog?
- From: DrDerekDoctors
- Re: Best way to create graphical window inside a dialog?
- From: Mihai N.
- Re: Best way to create graphical window inside a dialog?
- From: DrDerekDoctors
- Best way to create graphical window inside a dialog?
- Prev by Date: Re: Tree view issue with WM_LBUTTONUP
- Next by Date: Re: Best way to create graphical window inside a dialog?
- Previous by thread: Re: Best way to create graphical window inside a dialog?
- Next by thread: Re: Best way to create graphical window inside a dialog?
- Index(es):