Hi
I an trying to let my program save as jpg with a class from John Korejwa <[email protected]>.
I create a picture in my program and use :
BitBlt pbHidden.hDC, 0, 0, Picture5.Width / 15, Picture5.Height / 15, Picture5.hDC, 0, 0, SRCCOPY
For i = 1 To 200
DoEvents Next i
To copy all the contents labels and more to my new picturbox called pbHidden. This works well an I can use SavePicture to save as .bmp.
To save as jpg I have to get the contents of my Picturebox int this SubOpen
I have tried to say Set MyPic = Form2.pbHidden.PictureCode:Private Sub mnuOpen_Click() Dim MyPic As StdPicture Dim FileName As String FileName = FileDialog(Me, False, "Open Picture File", "Picture Files|*.jpg;*.jpeg;*.gif;*.bmp;*.wmp;*.rle;*.cur;*.ico;*.emf|All Files [*.*]|*.*") If Len(FileName) > 0 Then On Error Resume Next Set MyPic = LoadPicture(FileName) If Err.Number = 0 Then Set m_Image = New cImage m_Image.CopyStdPicture MyPic If mnuAutosize.Checked Then SetFormSize m_Image AdjustScrollBars m_Image Me.Caption = App.Title & " - " & FileTitleOnly(FileName) mnuSave(0).Enabled = True Else MsgBox "Can not load picture file" & vbCrLf & """" & FileName & """", vbExclamation, "File Load Error" End If Set MyPic = Nothing End If End Sub
This only works if I (hardcode) a bitmap into my PictureBox then I get the file say a picture boy.gif. But if I use the results of
Then Set MyPic is empty and I get no picture to save.Code:BitBlt pbHidden.hDC, 0, 0, Picture5.Width / 15, Picture5.Height / 15, Picture5.hDC, 0, 0, SRCCOPY For i = 1 To 200 DoEvents Next i
Any help. Please excuse my English.
Keli
PS I will be away for the weekend so I will not comment until monday




Reply With Quote