namespace play_stop
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button4_Click(object sender, EventArgs e)
{
timer1.Interval = 1000;
timer1.Start();
Counter = 0;
}
public void circles()
{
Graphics g = panel1.CreateGraphics();
g.DrawEllipse(
new Pen(Color.Red),panel1.Width / 2, panel1.Height / 2,75, 75);
Graphics h = panel1.CreateGraphics();
h.DrawEllipse(
new Pen(Color.Blue),
panel1.Width / 2, panel1.Height / 2, 50, 50);
Graphics j = panel1.CreateGraphics();
j.DrawEllipse(
new Pen(Color.Yellow),
panel1.Width / 2, panel1.Height / 2, 80,80);
Graphics k = panel1.CreateGraphics();
k.DrawEllipse(
new Pen(Color.Green),
panel1.Width / 2, panel1.Height / 2, 100,100);
}
public int counter;
public int Counter
{
get { return counter; }
set { counter = value; }
}
private void timer1_Tick(object sender, EventArgs e)
{
Counter++;
while ( counter < 5 )
{
circles();
}
}
}
}
sunil5
0
Newbie Poster
Recommended Answers
Jump to PostYou just posted your code, please give more info so we can help. What's the problem with your code? What were the result it gave you? What's the result you want to achive? What things did you try?
Jump to PostYou could write your property starting on line 40 in one line. It is called an auto-implemented property. It goes like this: public int counter { get; set; }
Don't know exactly what your problem is, could you tell us a bit more?
All 6 Replies
sunil5
0
Newbie Poster
AleMonteiro
238
Can I pick my title?
ddanbe
2,724
Professional Procrastinator
Featured Poster
sunil5
0
Newbie Poster
sunil5
0
Newbie Poster
Momerath
1,327
Nearly a Senior Poster
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.