PDA

Click to See Complete Forum and Search --> : PictureBox questions


nostradamus
Nov 2nd, 2002, 02:24 PM
How can I save an image as a result of a PictureBox.CreateGraphics.DrawLine method ?

sorry, I don't write English very well :o .

MrPolite
Nov 2nd, 2002, 02:38 PM
umm you mean you want to create a bitmap and draw a line in it, and then save it to a file?
if so you could do something like this:

Dim bmp As New Bitmap(100, 100) ' Create a 100x100 bitmap
Dim gr As Graphics = Graphics.FromImage(bmp)
gr.Clear(Color.White) ' make the background white
gr.DrawLine(Pens.Red, 0, 0, 100, 100)
bmp.Save("c:\myBmp.bmp")

gr.Dispose()
bmp.Dispose()

nostradamus
Nov 3rd, 2002, 01:02 PM
:D Thanks you very much.