Calculating Next 10 in Value

Viewed 30

I have this code that adds a dot per every 10 pixels (x), and I need to calculate the next 10 pixels per every count from 'Dots' int.

Graphics g = e.Graphics;

int Dots = 6;
g.FillEllipse(b, new Rectangle(x, y, 5, 5));
g.FillEllipse(b, new Rectangle(x + 10, y, 5, 5));
g.FillEllipse(b, new Rectangle(x + 20, y, 5, 5));

if (Dots > 3)
{
   for (int i = Dots - 1; i >= 0; i--)
   {
      // How to iterate next 10 based on the number of values > 3 ?
      g.FillEllipse(b, new Rectangle(x, y, 5, 5));

   }
}

I need for to iterate each of the follow lines (as a example) and allow it to bump up 10 for every value > 5 found in Dots.

Example -

x + 20, y, 5, 5

x + 30, y, 5, 5

x + 40, y, 5, 5

x + 50, y, 5, 5

etc..

I hope it makes sense. Thank you

1 Answers

SOLVED

for (int i = Dots - 1; i >= 0; i--)
{
   g.FillEllipse(b, new Rectangle(x + (i * 10), y, 5, 5));
}

I learned in order to step 10 every iteration, use this in place of the expected value:

(i * 10)
Related