- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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...
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...
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Show us your WM_PAINT block for the figure -- there lie the dragons.
Jugoslav
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
here is the code...hope i didnt make any mistake :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page