What"s the best way to clear the result of Drawline() on a Picture

What"s the best way to clear the result of Drawline() on a Picture

am 17.11.2007 16:48:01 von PK Ferrick

Hi all,

My first post to MSDN... I've recently started to get into VB.NET, having
been a casual VB user for a few years. So far, it's going OK. I've managed
to figure out
how to draw lines on a PictureBox, using code like this:

g = PictureBox1.CreateGraphics()
p = New Pen(char_color, pen_width)
p.LineJoin = Drawing2D.LineJoin.Round

g.DrawLine(p, path.s.X, path.s.Y, path.e.X, path.e.Y)


and that's just peachy. What I'd like to do now is erase the lines and have
the
PictureBox revert back to the jpeg it started with.

At first it seemed like

g.Clear()

was going to do it, but I don't want to fill the box with a color- I want it
to show the
original picture.

Any hints would be greatly appreciated. Thank you.

Pat Ferrick

RE: What"s the best way to clear the result of Drawline() on a Picture

am 17.11.2007 19:26:00 von PRSoCo

You'll have to reload the graphics from where ever you loaded it from. By
drawing on the picture you've actually modified the bitmap that you
originally loaded.

--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#


"PK Ferrick" wrote:

> Hi all,
>
> My first post to MSDN... I've recently started to get into VB.NET, having
> been a casual VB user for a few years. So far, it's going OK. I've managed
> to figure out
> how to draw lines on a PictureBox, using code like this:
>
> g = PictureBox1.CreateGraphics()
> p = New Pen(char_color, pen_width)
> p.LineJoin = Drawing2D.LineJoin.Round
>
> g.DrawLine(p, path.s.X, path.s.Y, path.e.X, path.e.Y)
>
>
> and that's just peachy. What I'd like to do now is erase the lines and have
> the
> PictureBox revert back to the jpeg it started with.
>
> At first it seemed like
>
> g.Clear()
>
> was going to do it, but I don't want to fill the box with a color- I want it
> to show the
> original picture.
>
> Any hints would be greatly appreciated. Thank you.
>
> Pat Ferrick
>
>
>
>