R
Rich P
I have a bunch of dots that I draw on a form and connect them with
lines. I have 3 basic groups of dots within a larger group (of which I
have hundreds of the larger groups - meaning I will have nearly 1000 of
the individual dot groups). I need to color code these dots with 3
separate colors. So starting with a counter at 1 -- the 1 dots group
will be blue (for example) and 2 dots group will be yellow, the 3 dots
group will be purple -- this is for the first big group. In the 2nd big
group we have the 4 dots group (blue), the 5 dots group (yellow), the 6
dots group (purple). Then the next big group will have 7 dots group
(blue), 8 dots group (yellow), 9 dots group (purple)...
so the numbering would be 1,4,7,10, ... blue dots
2,5,8,11,... yellow dots
3,6,9,12,... purple dots.
if (x=1) dots.color = color.blue;
if (x=2) dots.color = color.yellow;
if (x=3) dots.color = color.purple;
if (x=4) dots.color = color.blue;
if (x=5) dots.color = color.yellow;
if (x=6) dots.color = color.purple;
...
In a loop I need to do something like this:
for (int x=1;x<999;x++)
{
...
if (x%something = 0) dots.color = color.blue;
if (x%somethingelse = 0) dots.color = color.yellow;
if (x%3=0) dots.color = color.purple;
...
}
I am tempted to do something convoluted like creating arrays of numbers
so that if I am on a particular number in an array - the dots are that
respective color
int[] a1 = new int[]{1,4,7,10,...};
int[] a2 = new int[]{2,5,8,11,...};
int[] a3 = new int[]{3,6,9,12,...};
the problem with this is that I will have hundreds of numbers in each
array. Surely there is a simpler way to perform this enumeration. Any
ideas/suggestions appreciated.
Rich
lines. I have 3 basic groups of dots within a larger group (of which I
have hundreds of the larger groups - meaning I will have nearly 1000 of
the individual dot groups). I need to color code these dots with 3
separate colors. So starting with a counter at 1 -- the 1 dots group
will be blue (for example) and 2 dots group will be yellow, the 3 dots
group will be purple -- this is for the first big group. In the 2nd big
group we have the 4 dots group (blue), the 5 dots group (yellow), the 6
dots group (purple). Then the next big group will have 7 dots group
(blue), 8 dots group (yellow), 9 dots group (purple)...
so the numbering would be 1,4,7,10, ... blue dots
2,5,8,11,... yellow dots
3,6,9,12,... purple dots.
if (x=1) dots.color = color.blue;
if (x=2) dots.color = color.yellow;
if (x=3) dots.color = color.purple;
if (x=4) dots.color = color.blue;
if (x=5) dots.color = color.yellow;
if (x=6) dots.color = color.purple;
...
In a loop I need to do something like this:
for (int x=1;x<999;x++)
{
...
if (x%something = 0) dots.color = color.blue;
if (x%somethingelse = 0) dots.color = color.yellow;
if (x%3=0) dots.color = color.purple;
...
}
I am tempted to do something convoluted like creating arrays of numbers
so that if I am on a particular number in an array - the dots are that
respective color
int[] a1 = new int[]{1,4,7,10,...};
int[] a2 = new int[]{2,5,8,11,...};
int[] a3 = new int[]{3,6,9,12,...};
the problem with this is that I will have hundreds of numbers in each
array. Surely there is a simpler way to perform this enumeration. Any
ideas/suggestions appreciated.
Rich