B
Brian Ward
I am trying to get to grips with some basic graphics, being new to C#.
I have this code (see below) in a simple project .. when I run it 6 text
strings are drawn, as I expected .. but this happens twice .. once with
a grey background and once with the white one.
Clearly I am missing something fundamental here.
Can anyone please explain.
TIA
===
Brian
=====
private void Form1_Paint(object sender, PaintEventArgs e)
{
this.BackColor = Color.White;
Graphics g = e.Graphics; // get a graphics object
Font ft = new Font("Arial", 30); // create a font ft
Brush br = new SolidBrush(Color.Tomato); // create a brush br
int y = 20;
for (int i = 0; i < 6; i++)
{
g.DrawString("Brian is texting a Window", ft, br, 30, y);
y += 50;
System.Threading.Thread.Sleep(1000); // pause for 1 sec
}
}
I have this code (see below) in a simple project .. when I run it 6 text
strings are drawn, as I expected .. but this happens twice .. once with
a grey background and once with the white one.
Clearly I am missing something fundamental here.
Can anyone please explain.
TIA
===
Brian
=====
private void Form1_Paint(object sender, PaintEventArgs e)
{
this.BackColor = Color.White;
Graphics g = e.Graphics; // get a graphics object
Font ft = new Font("Arial", 30); // create a font ft
Brush br = new SolidBrush(Color.Tomato); // create a brush br
int y = 20;
for (int i = 0; i < 6; i++)
{
g.DrawString("Brian is texting a Window", ft, br, 30, y);
y += 50;
System.Threading.Thread.Sleep(1000); // pause for 1 sec
}
}