Hello, the objective was to print a filled circle to the picturebox, and
print the color name to a textbox each 2 seconds. Following is the code I
used, however, I could never see anything except the last item in the
arraylist being printed, tried different ways to iterate through the colors,
different placing of the thread.sleep, but never see anything but the last
color in the array list, appreciate finding out why this doesn't work, or
how to make it work.
Thanks
Henry
private void DrawCirclesColors()
{
ArrayList col = new ArrayList();
col.Add("Black");
col.Add("Blue");
col.Add("GhostWhite");
// IEnumerator enumerator = col.GetEnumerator();
// while (enumerator.MoveNext())
// foreach (string item in col)
for (int x = 0; x< col.Count; x++)
{
Bitmap bm = new Bitmap(250, 250);
Graphics g = Graphics.FromImage(bm);
Brush bw = new
SolidBrush(Color.FromName(col[x].ToString()));
g.FillEllipse(bw, 60, 60, 120, 120);
label1.Text = col[x].ToString();
pictureBox1.BackgroundImage = bm;
Thread.Sleep(2000);
}
}
--
~
Most good judgment comes from experience.
Most experience comes from bad judgment.
~I'm there somewhere.~