« Answers 1.1.7 - Fixes… | Home | DevCon Hotel Scam Ale… »

Tip of day: Load GIF into WebImageView

If you need to load a GIF picture into a WebImageView, you need to build a WebPicture and put the GIF inside it:

// get some gif file dim f as FolderItem = SpecialFolder.Desktop.child("test.gif") // open GIF dim g as GIFMBS = f.OpenAsGIFMBS // get data for GIF file dim b as BinaryStream = BinaryStream.Open(f) dim s as string = b.Read(b.Length) // get picture dim fp as Picture = g.MakeFirstPicture // creates a new webpicture based on picture dim pic as new WebPicture(fp) // now fill the web picture pic.Data = s pic.MIMEType = "image/gif" pic.Filename = f.name // show picture in WebImageView me.Picture = pic
Verified to work in Xojo 2019r3.
24 02 16 - 20:47