PDA

Click to See Complete Forum and Search --> : Saving Pictures


Gaming_World
Aug 7th, 2001, 11:21 AM
How would I go about saving a picture that I drew at runtime?

007shahid
Aug 15th, 2001, 12:12 AM
Thats an easy one.
To a form add...
1. PictureBox (named: Picture1) with Auto Redraw set to True
2. Button (named: cmdSave)
and paste the following 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

007shahid
Aug 15th, 2001, 12:15 AM
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 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