How to delay an action using timer?
Im trying to slowly draw a grid ( cell by cell ). I tried to make a timer which increments "ticks" variable and then put "if(ticks % 10 == 0)" inside of for loop but it will skip cells. How can i pause the "for" loop with a timer? Piece of code: private void timer1_Tick(object sender, EventArgs e) { tick++; Text = tick.ToString(); } private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (tick % 10 == 0) g.DrawRectangle(Pens.Red, i * h, j * w, h, w); } } }