Adding Images to Project for use with Canvas

Is there a way to add a number of images as resources to my XoJo project and then be able to assign the image to view to a canvas object when needed?

I’d like these to be resources within XoJo and not need to be loaded from disk at a later time.

If you drag & drop an image into the Xojo navigator, the section on the left in Xojo’s window, it will create an ImageSet.
In this image set you can then drag & drop @2x (retina images for Desktop) and @3x (3x retina images for iOS).

You can then use the resource as a Canvas.backdrop or ImageWell.Image

2 Likes

Hi Steve,

I would suggest looking into the Image Set Editor to adding images to your Xojo project.

Once your “image set” is set up, it can be accessed as a global variable by the name you give it. Then you can use Canvas.Backdrop property (either within the Xojo IDE or programmatically) to show your image.

You can also use the Canvas.Paint event to include or manipulate your image.

I hope that helps you get started.

3 Likes

if you drag and drop images from other place than your project folder you may have to click collect project items in menu.
this would also collect other external files, so be careful.

if you subclass a canvas you can add own properties and make them visible for the designer with the context menu inspector behavior.

1 Like

This is helpful, thanks!

I would like to use this feature to create self-contained archival versions of my apps, but I’m terrified to do so because of the lack of detail in the documentation as to what actually happens. In particular I’d like to know if it makes copies of all externals, or does it move the source files? If the latter, then it’d probably break every other program that uses the externals, no?

Sorry if this is hijacking the thread…

1 Like