How would I go about saving a picture that I drew at runtime?
Printable View
How would I go about saving a picture that I drew at runtime?
Thats an easy one.
To a form add...
1. PictureBox (named: Picture1) with Auto Redraw set to2. Button (named: cmdSave)PHP Code:True
and paste the following code
PHP Code:'Code by Shahid Thaika
Private Sub cmdSave_Click()
'Save the picture
SavePicture Picture1.Image, "C:\Picutre.bmp"
MsgBox "Saved Picture to 'C:\Picture.bmp'", vbOKOnly + vbInformation, "Saved"
End Sub
'Put whatever code you want for drawing
'But draw it to Picture Box
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Start at wherever we clicked first
Picture1.CurrentX = X
Picture1.CurrentY = Y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Draw lines if only the Ctrl Key is pressed
If Shift = 2 Then Picture1.Line -(X, Y)
End Sub
Oops used PHP instead of Code. This will look better
To a form add...
1. PictureBox (named: Picture1) with Auto Redraw set to True
2. Button (named: cmdSave)
and paste the following code
Code:'Code by Shahid Thaika
Private Sub cmdSave_Click()
'Save the picture
SavePicture Picture1.Image, "C:\Picutre.bmp"
MsgBox "Saved Picture to 'C:\Picture.bmp'", vbOKOnly + vbInformation, "Saved"
End Sub
'Put whatever code you want for drawing
'But draw it to Picture Box
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Start at wherever we clicked first
Picture1.CurrentX = X
Picture1.CurrentY = Y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Draw lines if only the Ctrl Key is pressed
If Shift = 2 Then Picture1.Line -(X, Y)
End Sub