X
Xarky
Hi,
I am overriding the method given to draw ellipses on my window,
using the following code. My problem is that I have a button that
every time it is pressed, a variable is inremented, indicating that a
new ellipse is to be drawn. What should I do to refresh the window to
draw the new ellipse.
Thanks in Advance
private void Form1_Load(object sender, System.EventArgs e)
{
tot=1;
}
protected override void OnPaint(PaintEventArgs pe)
{
Graphics g = pe.Graphics ;
Pen pn = new Pen( Color.Crimson);
Rectangle rect;
for (int x=0; x<tot; x++)
{
rect= new Rectangle (25,(80*x)+5,40,40);
g.DrawEllipse( pn, rect );
} // end for loop
}
private void button1_Click(object sender, System.EventArgs e)
{
tot++;
}
I am overriding the method given to draw ellipses on my window,
using the following code. My problem is that I have a button that
every time it is pressed, a variable is inremented, indicating that a
new ellipse is to be drawn. What should I do to refresh the window to
draw the new ellipse.
Thanks in Advance
private void Form1_Load(object sender, System.EventArgs e)
{
tot=1;
}
protected override void OnPaint(PaintEventArgs pe)
{
Graphics g = pe.Graphics ;
Pen pn = new Pen( Color.Crimson);
Rectangle rect;
for (int x=0; x<tot; x++)
{
rect= new Rectangle (25,(80*x)+5,40,40);
g.DrawEllipse( pn, rect );
} // end for loop
}
private void button1_Click(object sender, System.EventArgs e)
{
tot++;
}