"ham Come>" <hd****@hotmails.com> schrieb:
I have an application with has some drawing operations
the code is sth like this:
For i as integer = 0 to 100
dim g as graphics
g = me.pictureBox1.CreateGraphics
g.Draw sth... ...
\\\
g.Dispose()
///
But I would create the 'Graphics' object only once, not in every iteration
of the loop.
Next i
I just don't know how to save the final drawings to a file (
i mean the total drawings).
Instead of drawing onto the picturebox, create a 'Bitmap' object of
appropriate size and use 'Graphics.FromImage' to obtain a 'Graphics' object
for the bitmap. Then use this object to draw onto the bitmap. Then you can
either assign the bitmap to the picturebox's 'Image' property or draw it
onto the picturebox's surface in its 'Paint' event handler or 'OnPaint'
method. Simply call the 'Bitmap' object's 'Save' method to persist it to
disk.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>