public partial class Form1 : Form
{
private int num;
public Form1()
{
InitializeComponent();
this.BackColor = Color.White;
}
public void Display(Graphics g,int num)
{
SolidBrush b = new SolidBrush(Color.Red);
g.FillRectangle(b, 20, 20, 5+num, 5);
}
public void UnDisplay(Graphics g,int num)
{
SolidBrush b = new SolidBrush(Color.White);
g.FillRectangle(b, 20, 20, 5+num, 5);
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
Graphics g = this.CreateGraphics();
this.Show();
num = 0;
Display(g, num);
UnDisplay(g, num);
num++;
}
}