Consulting

Results 1 to 2 of 2

Thread: Flip an image in a userform?

  1. #1
    VBAX Newbie
    Joined
    May 2013
    Posts
    5
    Location

    Flip an image in a userform?

    Hi. I'm trying to load a jpg in an image box of a form (all working fine) and then mirror, or flip it horizontally conditionally, but I can't get the image to flip at all. Can someone help understand how to do this?

    Sub Add_Dynamic_Image()
    CabSideRefGuide.ImgSidePanel.Picture = LoadPicture("")
    On Error GoTo 10
    CabSideRefGuide.ImgSidePanel.Picture = LoadPicture(Worksheets("RefData").Range("FILEPATH").Value)
    CabSideRefGuide.ImgSidePanel.Picture.Flip msoFlipVertical  This doesn't work
    CabSideRefGuide.ImgSidePanel.Picture.Flip msoFlipHorizontal This doesn't work
    Exit Sub
    10:
    CabSideRefGuide.ImgSidePanel.Picture = LoadPicture("")
    CabSideRefGuide.ImgSidePanel.Picture = LoadPicture(Worksheets("RefData").Range("FILEPATHNOIMAGE").Value)
    Call UpdateDrawerImages
    End Sub

  2. #2
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    There is no Flip method for an IPictureDisp object, which is why that won't work. There is no simple method for this that I am aware of. You can probably do it all in memory using GDI but it might be simplest to save the picture to disk, load it onto a worksheet where you can flip it your way, then copy it back to the image control using something like Stephen Bullen's PastePicture code.
    Be as you wish to seem

Posting Permissions

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