c# - Cannot invalidate in loops? -
i have following code:
for(int i=0;i<10;i++) { graphics.drawimage(image, i*20,50); invalidate(); }
but redrawns after loop. why?
edit: making simple movement , wants update after each step.
because invalidate
not repaint immediately, tells repaint needed. when method completed, , program idle again, repaint performed.
the quick , dirty solution add application.doevents()
after invalidate
call, suggest rewriting logic use timer or similar instead of using loop animate.
Comments
Post a Comment