dcsimg
Results 1 to 3 of 3

Thread: VB6 Crystal Reports XI (11) picture is cropped instead of scaling to fit the control

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2018
    Posts
    3

    VB6 Crystal Reports XI (11) picture is cropped instead of scaling to fit the control

    The report has a OleObject to display picture. The control original size is set to 1.97 inch x 1.97 inch. The picture it points to has a dimension as 640x480 with 72 dpi. The picture is loaded with code like this:
    Code:
    Dim fso As New FileSystemObject
    If fso.FileExists(PicturePath) Then
          Set Picture1.FormattedPicture = LoadPicture(PicturePath)
    End If
    Based on online posts, it looks to me crystal report by default will auto scale the picture to fit the control. However, in my case, it auto cropped the picture to fit it. The configuration in the picture tab seem only change the cropped size. I cannot find a way to switch it to scaling instead.

    Is there a way to make it to scale the picture?

    Thank you.

  2. #2

    Thread Starter
    New Member
    Join Date
    Nov 2018
    Posts
    3

    Re: VB6 Crystal Reports XI (11) picture is cropped instead of scaling to fit the cont

    I ended with a workaround to solve the problem.
    Since there is not much I can do with the crystal report picture control, I added two invisible picture boxes to the parent form to help scale the picture first then assign it to the report. Though not ideal, it at least allow the picture to display as expected in the report.
    Code:
        'Load full size picture
        frmReport.Picture1.AutoSize = True
        frmReport.Picture1.Picture = LoadPicture("PathToPicture")
        'Resize Picture
        With frmReport.Picture2
            .AutoRedraw = True
            .PaintPicture frmReport.Picture1.Picture, _
            .ScaleLeft, .ScaleTop, .ScaleWidth, .ScaleHeight, _
            0, 0, frmReport.Picture1.ScaleWidth, frmReport.Picture1.ScaleHeight
            .Picture = .Image
        End With
        'assign scaled picture to report control
        Set Picture1.FormattedPicture = frmReport.Picture2.Picture
    Last edited by sweec; Nov 27th, 2018 at 05:37 PM.

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2018
    Posts
    3

    Re: VB6 Crystal Reports XI (11) picture is cropped instead of scaling to fit the cont

    Deleted.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width