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

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -