Windows Develop Bookmark and Share   
 index > Windows Forms General > How can i draw graphics in a picturebox
 

How can i draw graphics in a picturebox

When i try to draw something in apicturebox, it isn't shown.

I use this command

Dim G As System.Drawing.Graphics = picturebox1.CreateGraphics()

G.DrawLine(Pens.Black, 0, 0, 200, 200)

If iinstead picturebox1.creategraphics write me.creategraphics, the line is drawn on the background, so the command should work. Just not in the picturebox

Dan Mikkelsen  Saturday, December 23, 2006 2:33 PM
With "Me.CreateGraphics", you're drawing on the form, not the picture box. You'll be drawing *behind* the PB so can't see the output. Always do your drawing in a Paint event, you'll lose the graphics when the form or PB repaints itself.
nobugz  Saturday, December 23, 2006 3:22 PM
With "Me.CreateGraphics", you're drawing on the form, not the picture box. You'll be drawing *behind* the PB so can't see the output. Always do your drawing in a Paint event, you'll lose the graphics when the form or PB repaints itself.
nobugz  Saturday, December 23, 2006 3:22 PM
Hello,

I'm currently workin on application for Smarth phone on Windows Mobile 6.I have a problem with creating graphic from picture box. Can you plesae give me some directions.
Deos  Monday, September 10, 2007 9:12 AM

You can use google to search for other answers

Custom Search

More Threads

• showing child form in mdi parent
• Terminating An Executable File
• Ignoring Escape
• Two Questions ?? Special dialog & Auto Hide
• datagrid.refresh() doesnot work !
• datagridview default column width
• Office xp PIA Placing two documents together
• Multilingual Form C#
• Validating username and password
• open minimized window with keystroke