Results 1 to 3 of 3

Thread: Somebody HELP ME please!

Hybrid View

  1. #1

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134

    Question

    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)
    Code:
    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??????
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  2. #2
    Guest
    Save it's Image, not the Picture.

    Code:
    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

  3. #3

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Thanks a ton! It worked like a charm.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width