Results 1 to 6 of 6

Thread: I´m lost!

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2011
    Posts
    81

    I´m lost!

    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
    Code:
    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
    I have tried to say Set MyPic = Form2.pbHidden.Picture
    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
    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
    Then Set MyPic is empty and I get no picture to save.

    Any help. Please excuse my English.

    Keli

    PS I will be away for the weekend so I will not comment until monday
    Last edited by Hack; Jun 16th, 2011 at 12:27 PM. Reason: Added Code Tags

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