473,471 Members | 4,648 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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


Nov 17 '07 #1
1 1613
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

Nov 17 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
10
by: Peter | last post by:
I want to draw some lines on a widget. This works ok, but when I want to redraw, the old lines are still there. How do I clear or refresh the widget, so I can draw a new set of lines? Code...
92
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption?...
8
by: Hermawih | last post by:
Hello , I want your opinion about this . In order to say it clearly , I think I have to describe it in long sentences . I could consider myself as Intermediate/Advance Access Developer ;...
2
by: Uwe Porsch | last post by:
Maybe a stupid question, but I don't know how to do. I have an application where I read information from a database and show it on a form. It also includes a picture stored as BLOB. On the form I...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
3
by: Ben Bush | last post by:
I had the following code and when I clicked the left mouse button one time. I got green line and the second click got a purple line and the green disappeared. I was confused by two questions:...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
2
by: Carl Johansson | last post by:
Except for the syntax, what is the difference, if any, between this... /* ---------------------------------------------------------------------- */ private void Form1_Paint(object sender,...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.