PDA

View Full Version : Flip an image in a userform?



rclark
04-27-2016, 02:56 PM
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

Aflatoon
04-28-2016, 12:42 AM
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.