| | |
Drawing line in pictureBox
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
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: FTP Server Directory Treeview
| Thread Tools | Search this Thread |
.net access algorithm angle array asp.net bitmap box broadcast c# capturing check checkbox client combobox control conversion csharp database databasesearch datagrid datagridview dataset datetime dbconnection degrees delegate design development disappear draganddrop drawing encryption enum eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net image input install interface java libraries list loop marshalbyrefobject math monodevelop mouseclick movingimage msword mysql operator path pause photoshop php picturebox pixelinversion platform post programming radians regex remoting richtextbox server sleep socket sql statistics string study system.servicemodel table tcpclientchannel text textbox thread time timer update usb usercontrol validation virtualization visualbasic visualstudio webbrowser winforms wpf wpfc# xml






