Form invalidate() in c sharp windows Application
- by Pramodh
hi,
i need to animate an object in c sharp windows application
int l_nCircleXpos = 9, l_nCircleYpos = 0;
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics l_objGraphics = this.CreateGraphics();
Pen l_circlePen = new Pen(Color.Blue);
SolidBrush l_circleBrush = new SolidBrush(Color.Blue);
l_objGraphics.DrawEllipse(l_circlePen, l_nCircleXpos, l_nCircleYpos, 30, 30);
l_objGraphics.FillEllipse(l_circleBrush, l_nCircleXpos, l_nCircleYpos, 30, 30);
Pen l_rectPen = new Pen(Color.Red);
}
private void timer1_Tick(object sender, EventArgs e)
{
l_nCircleXpos++;
l_nCircleYpos++;
}
private void timer2_Tick(object sender, EventArgs e)
{
Invalidate();
}
but in timer2 its invalidating the entire form. i need to invalidate the specific circle area only.
please help to do this in a better way
thanks in advance