Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

eraser dialog box...

Intel_C_Intel
Employee
815 Views
hi,
i have created a dialog box by using CreateDialogParam. user can change starting parameters for a figure which will be displayed on the parent window. as i move the dialog box, it erases the current figure. what i miss?

thank you all...
0 Kudos
3 Replies
Jugoslav_Dujic
Valued Contributor II
815 Views
Show us your WM_PAINT block for the figure -- there lie the dragons.

Jugoslav
0 Kudos
Intel_C_Intel
Employee
815 Views
here is the code...hope i didnt make any mistake :)





0 Kudos
Jugoslav_Dujic
Valued Contributor II
815 Views
I took only a superficial look:

You're leaking hrgn (never deleting it). Actually, there's no need at all for regions -- why not simply using FillRect? If that doesn't solve it, please repost and I'll dig more into it.

Side note:
Note that same effect (pale yellow background, isn't it?) can be achieved by ommitting WM_PAINT altoghether and specifying WC%hbrBackground to a pale yellow brush. The process goes like this:

- When something is to be redrawn, WM_ERASEBKGND is first sent, provided that WC%hbrBackground is non-NULL.
- By default (DefWindowProc), entire background is filled with WC%hbrBackground
- Immediately after that, WM_PAINT is sent, and you can draw your image here. Portions that you don't draw remains in background color. If you don't handle WM_PAINT, nothing is drawn over the already filled background.

So, if you cover entire window area in WM_PAINT (using FillRect, BitBlt or similar), you should set hbrBackground to NULL, so that erasing doesn't take place twice. That tends to reduce flicker during resizing as well.

Jugoslav
0 Kudos
Reply