| | |
Drawing line in pictureBox
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2008
Posts: 32
Reputation:
Solved Threads: 0
Hi,
I have picture box with some image int it. I want to draw a line on the image. But when code executes, line is there but image is gone.
Here is the code:
bitmap bmp=new bitmap(pb.width,pb.height);
graphics g=new graphics.fromImage(bmp);
pen p=new pen(color.black,5);
g.drawLine(p,0,0,10,10);
Line is there, but underlaying image is gone. What should I do?
Pete
I have picture box with some image int it. I want to draw a line on the image. But when code executes, line is there but image is gone.
Here is the code:
bitmap bmp=new bitmap(pb.width,pb.height);
graphics g=new graphics.fromImage(bmp);
pen p=new pen(color.black,5);
g.drawLine(p,0,0,10,10);
Line is there, but underlaying image is gone. What should I do?
Pete
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
http://msdn.microsoft.com/en-us/libr...l.onpaint.aspx says there should be.
failing that, do a search for captureing from a paintbox/form and saving it as a bmp, so you update the bmp in memory.
failing that, do a search for captureing from a paintbox/form and saving it as a bmp, so you update the bmp in memory.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
this was covered in another thread - you need to store the picture in memory, and then copy and show only in the picture box what the user is expecting to see
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
•
•
Join Date: Nov 2008
Posts: 44
Reputation:
Solved Threads: 4
Won't the drag and drop method for control work in WM?
.Net Developer - 3D Game Designer
My Portfolio/Blog: http://www.hieu.co.uk
My Portfolio/Blog: http://www.hieu.co.uk
![]() |
Similar Threads
- Creatig ellipse on a picturebox and making ellipse a link (C#)
- Drawing Multiple Lines (VB.NET)
- Invalidate picturebox with rectangle on (C#)
- PictureBox Image.Save Error (VB.NET)
- Graphing in PictureBox (C#)
- drawing in picturebox (Visual Basic 4 / 5 / 6)
Other Threads in the C# Forum
- Previous Thread: Cutting strings
- Next Thread: logic of building a system where laods of people might be on at the same time.
| Thread Tools | Search this Thread |
.net access algorithm array barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom cyclethruopenforms data database datagrid datagridview dataset date/time datetime degrees development dll draganddrop drawing encryption enum event excel file finalyearproject form format forms function gdi+ getoutlookcontactusinfcsvfile globalization httpwebrequest image index input install installer java label list listbox mandelbrot math mono mouseclick mysql operator panel path photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox save server silverlight sleep socket sql sql-server statistics stream string table text textbox thread time timer timespan update usercontrol users validate validation visualstudio webbrowser wia windows winforms wpf xml






