From: Tony Johansson on
Hi!

Nothing is being drawn when I run this piece of code ?
I can't see any wrong in the code but there must be some mistake in it.

private void Form1_Paint(object sender, PaintEventArgs e)
{
Pen p = new Pen(Color.Red, 7);
p.DashStyle = DashStyle.Dot;
Bitmap bm = new Bitmap(400,400);
Graphics g = Graphics.FromImage(bm);
g.DrawPie(p,0,0,350,350,290,90);
}

//Tony


From: Alberto Poblacion on
"Tony Johansson" <johansson.andersson(a)telia.com> wrote in message
news:OxZriJf%23KHA.5464(a)TK2MSFTNGP05.phx.gbl...
> Nothing is being drawn when I run this piece of code ?
> I can't see any wrong in the code but there must be some mistake in it.
>
> private void Form1_Paint(object sender, PaintEventArgs e)
> {
> Pen p = new Pen(Color.Red, 7);
> p.DashStyle = DashStyle.Dot;
> Bitmap bm = new Bitmap(400,400);
> Graphics g = Graphics.FromImage(bm);
> g.DrawPie(p,0,0,350,350,290,90);
> }

You are drawing on a bitmap that you just created, and you never show
the bitmap. If you want the graphic to appear on screen, you should draw on
e.Graphics:

private void Form1_Paint(object sender, PaintEventArgs e)
{
Pen p = new Pen(Color.Red, 7);
p.DashStyle = DashStyle.Dot;
Graphics g = e.Graphics;
g.DrawPie(p,0,0,350,350,290,90);
}