473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Graphics Help

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.~
Nov 22 '06 #1
2 1065

Henry wrote:
Brush bw = new
SolidBrush(Color.FromName(col[x].ToString()));
g.FillEllipse(bw, 60, 60, 120, 120);
label1.Text = col[x].ToString();
pictureBox1.BackgroundImage = bm;
Put here this code:

pictureBox1.Refresh();
Thread.Sleep(2000);
Nov 22 '06 #2
Thanks, that was the answer...
Henry

"marss" <ma***@ukr.netwrote in message
news:11*********************@f16g2000cwb.googlegro ups.com...
>
Henry wrote:
> Brush bw = new
SolidBrush(Color.FromName(col[x].ToString()));
g.FillEllipse(bw, 60, 60, 120, 120);
label1.Text = col[x].ToString();
pictureBox1.BackgroundImage = bm;

Put here this code:

pictureBox1.Refresh();
> Thread.Sleep(2000);
Nov 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Sanjay | last post by:
hi, We are currently porting our project from VB6 to VB .NET. Earlier we used to make scale transformations on objects like pictureBox , forms etc.Now Such transformations are made on the...
14
by: Pmb | last post by:
At the moment I'm using Borland's C++ (http://www.borland.com/products/downloads/download_cbuilder.html#) I want to be able to take an array of points and plot them on the screen. Is there a way...
2
by: Tamer Abdalla via DotNetMonster.com | last post by:
Hello, everyone! I DO need some help in order to understand how to create graphics in VB.NET. I'm a little bit confused... I once knew a time when using Point & PSet was almost the only way to...
8
by: Nathan Sokalski | last post by:
I am trying to write code to rotate a graphic that I have. Here is the code I am currently using: Dim frogbitmap As New Bitmap(Drawing.Image.FromFile(Server.MapPath("images/frog.gif"))) Dim...
7
by: Peter Row | last post by:
Hi, I've started work on my own control some parts of which use standard controls, others I need to draw on my controls surface to get the display output I require, however.... I seem to be...
15
by: Hamed | last post by:
Have I posted the message to wrong newsgroup? Or Does the question is so much strage? Would someone please kindly direct me to a true newsgroup or resource? Best Regards Hamed
9
by: she_prog | last post by:
Dear All, I need to save the content of a panel to a bitmap. The panel can have many child controls which also need to be saved. The problem would be solved if I could have the panel saved to a...
1
by: Ringo | last post by:
I need some help. I have an app that talks to a sonar board via the serial port. In my sp_DataReceived I gather all the data and put it into arrays. Then I want to draw the data in a pictureBox. I...
9
by: koschwitz | last post by:
Hi, I hope you guys can help me make this simple application work. I'm trying to create a form displaying 3 circles, which independently change colors 3 times after a random time period has...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.