See Also Example
Saves a picture from a form, picture box, or image control into a file.
Syntax
SavePicture picture, stringexpression
Remarks
The SavePicture statement has these parts:
Part Description
picture Picture or Image property from which the picture file is to be created.
stringexpression File name of the picture file to save.
If a picture was loaded from file to the Picture property, either at design time
Image Property
LoadPicture Function
Picture Property
The example uses the SavePicture statement to save a picture drawn on a form. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim CX, CY, Limit, Msg, Radius ' Declare variables.
ScaleMode = 3 ' Set scale to pixels.
AutoRedraw = -1 ' Turn on AutoRedraw.
Width = Height ' Change width to match height.
CX = ScaleWidth / 2 ' Set X position.
CY = ScaleHeight / 2 ' Set Y position.
Limit = CX ' Limit size of circles.
For Radius = 0 To Limit ' Set radius.
Circle (CX, CY), Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
DoEvents ' Yield for other processing.
Next Radius
Msg = "Choose OK to save the graphics from this form "
Msg = Msg & "to a bitmap file."
MsgBox Msg
SavePicture Image, "TEST.BMP" ' Save picture to file.
End Sub