Results 1 to 7 of 7

Thread: [RESOLVED] Saving images w/Common Dialog

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2008
    Posts
    19

    Resolved [RESOLVED] Saving images w/Common Dialog

    :/

    I'm trying to save a picture in a picturebox

    Code:
    Private Sub mnuSave_Click()
    cdlDialog.Filter = "Images (*.jpg) | *.jpg"
    cdlDialog.ShowSave ' show save dialog box..cm
    SavePicture picImg.Picture, cdlDialog.FileName
    End Sub
    I'm getting error 380 "Invalid Property Value".

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Saving images w/Common Dialog

    Are you sure you are wanting to save picImg.Picture or should it be picImg.Image? Double check. If you haven't Set picImg.Picture = something, then picImg.Picture is probably zero.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2008
    Posts
    19

    Re: Saving images w/Common Dialog

    Yep, that was it. But another problem now

    In the program you can draw your picture and save it. When trying to re-open that picture, it is too large (There's an image size limit).

    Here's my code for the image limiting...
    Code:
        
    If picImg.Picture.Height > 9285 Or picImg.Picture.Width > 10860 Then
            MsgBox "Sorry, that picture is too large." & picImg.Picture.Height & "x" & picImg.Picture.Width
            Set picImg.Picture = LoadPicture(vbNullString)
            picImg.Height = 6855
            picImg.Width = 9705
    End If
    What scale would the images from a dialog box be in? It's not pixels, and not twips. The images saved are 643x453 pixels. The msgbox is saying it's 11986x17013 in w/e units.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Saving images w/Common Dialog

    A picture's width & height are in a scalemode called HiMetrics. To determine the actual size. Replace vbPixels with vbTwips or other scale as needed
    Code:
    Debug.Print "Width="; ScaleX(picImage.Picture.Width, vbHimetric, vbPixels)
    Debug.Print "Height="; ScaleY(picImage.Picture.Height, vbHimetric, vbPixels)
    Last edited by LaVolpe; Jan 5th, 2008 at 05:37 PM.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2008
    Posts
    19

    Re: Saving images w/Common Dialog

    That's giving me an error...Invalid procedure or argument.

  6. #6
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Saving images w/Common Dialog

    Sorry, try again, you may have copied the code before I realized a typo.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jan 2008
    Posts
    19

    Re: Saving images w/Common Dialog

    That works! Thanks.

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