Click here to Skip to main content
16,019,273 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to draw lines in a picturebox if a button is clicked?
Posted
Comments
[no name] 12-Sep-12 14:28pm    
Well you *could* use a pen or pencil and draw the lines inside the picturebox on your monitor but that might be messy. Have you thought about using GDI?

It looks like you are trying to abuse PictureBox. There are no situations where you need to draw on it, even though you can. If you need to draw in a bitmap, you can do it directly. If you need to draw on some UI control, PictureBox won't help you at all; it would only create and additional level of indirection, giving nothing in return. It would only eat up your development time and some extra resources, including CPU time.

What to do instead? This is easy. Please see my past answers:
How do I clear a panel from old drawing[^],
draw a rectangle in C#[^],
Append a picture within picturebox[^].

Please also see these related answers:
Drawing Lines between mdi child forms[^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
capture the drawing on a panel[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900