Locking image to WebImageViewer

Can you somehow lock an image to a WebImageViewer so that if you resize the viewer in the IDE the image is automatically resized instead of having portions cut off?

It’s very fiddly and time-consuming when tweaking WebPages to have to keep leaving Xojo, resizing a graphic by a few pixels reimporting it, relinking the new image to the viewer and checking the effect.

In the WebImageViewer.Opening event, try “cover” or “contain” for the background image size:

Me.Style.Value("background-size") = "cover" // Try also "contain"

Is this what you need?

Thanks, I’ll try that as it will be a big help on pages that only have one or two small graphics.

I’ve started doing my graphics-rich pages entirely in a graphics app to fit the entire page and maybe that’s the best way to do them as as I have more control and I just need to add buttons and other controls on top.

1 Like