PDA

Click to See Complete Forum and Search --> : Somebody HELP ME please!


Sastraxi
Jul 29th, 2000, 09:19 AM
How do you save a picture with the hDC of a Picturebox? I've blitted to it, and now I want to save it. Any thoughts?

(I also have GetPixel and SetPixelV declared)

Sub BlitAndSave{}
Dim I
Dim J

setpixelv picture1.hdc,4,2,rgb(0,76,174)
savepicture picture1.picture, app.path & "\test.bmp"
End Sub


What am I doing wrong??????

Jul 29th, 2000, 09:57 AM
Save it's Image, not the Picture.


Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long

Private Sub cmdSave_Click()

'Save the Picture
SavePicture Picture1.Image, "C:\Windows\Desktop\MyBmp.bmp"

End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

'Draw a Pixel when the mouse is down
SetPixel Picture1.hdc, X, Y, vbBlack
Picture1.Refresh

End Sub

Private Sub Form_Load()

'Set the PictureBox's properties
Picture1.AutoRedraw = True
Picture1.ScaleMode = vbPixels

End Sub

Sastraxi
Jul 29th, 2000, 10:02 AM
Thanks a ton! It worked like a charm.