Graphics object and Images

Salat

Well-known member
Joined
Mar 5, 2002
Messages
81
Location
Poland, Silesia
What Im trying to do is:

Draw something at the picturebox, and then set the whole paintings as an image, so I could draw it at some other controls useing DrawImage. Ive searched the forum, msdn, help files and I didnt find the solution.

thanks for help...
 
Youll have to draw your image in an offscreen bitmap instead. You can then assign that image to a picturebox or draw it wherever you like. Use the Bitmap constructor to create the image, and use Graphics.FromImage to get a Graphics object from it to draw on it.
 
I just said... with the Bitmap constructor and Graphics.FromImage.

Code:
Dim b As New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(b)

g.DrawLine(whatever)

g.Dispose()
myPictureBox.Image = b

All untested of course but should work.
 
Back
Top