[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".
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.
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.
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)
Re: Saving images w/Common Dialog
That's giving me an error...Invalid procedure or argument.
Re: Saving images w/Common Dialog
Sorry, try again, you may have copied the code before I realized a typo.
Re: Saving images w/Common Dialog