473,769 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
+ 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.Cre ateGraphics()
p = New Pen(char_color, pen_width)
p.LineJoin = Drawing2D.LineJ oin.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 1638
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.Cre ateGraphics()
p = New Pen(char_color, pen_width)
p.LineJoin = Drawing2D.LineJ oin.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
19156
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 any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
10
11716
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 snip below. TIA Peter
92
6530
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? cheers, reed
8
4051
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 ; Intermediate/Advanced Database designer . Because of the requirements , I must create Web Application . Access Pages is not suitable for that so I think about learning VB Net / ASP Net . I am
2
18264
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 have a clear button. When hitting the button als fields on the form may cleared. Everything works fine, but I don't know how to clear the picture out of picture.image. Has anyone an sample in C# ?
13
5058
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
3169
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: First, Clicknum increases when every time I click the button. Is it possible to reset Clicknum to 0? Second, how to do something like: I click the left button the first time, the green line appear then disappear, the purple line appear(just as the...
669
26201
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 paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
2
1384
by: Carl Johansson | last post by:
Except for the syntax, what is the difference, if any, between this... /* ---------------------------------------------------------------------- */ private void Form1_Paint(object sender, PaintEventArgs e) { Pen pen = null; try { pen = new Pen(Color.MidnightBlue, 1.0F);
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10219
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9998
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.