c - Draw when called -
i'm trying draw table of colors (already constructed) selected area in window.
i'm learning this source. however, in of given code examples, draw being carried out window opened.
what should if want drawing occur when click menu item, or not in beginning?
edit:
i created new window called gifpanel
drawn.
my variables:
hwnd gifpanel; rect r;
my gifpanelproc:
case wm_paint: drawframe(gifpanel); // drawframe uses beginpaint, setpixel, endpaint in order draw break;
next, have function click following:
getclientrect(gifpanel, &r); invalidaterect(gifpanel, &r, false);
when first opening window, can see gifpanel
has red background (just test working).
after executing process above, no pixels changed. explain why?
a window required draw whenever receives wm_paint
message; typically wm_erasebkgnd
message first erase background. if don't want draw table need keep flag can test in wm_paint
handler skip drawing of table.
in menu handler, first set flag , use invalidaterect
cause wm_paint
message generated.
Comments
Post a Comment