Resize Image to Canvas

Hello,
I am developing a program that needs pictures, I wanted to be able to auto resize the imported in to fit into the Canvas. and then if a user clicks on it, it gets enlarged… (Kinda like a thimbnail) How do I do this

Also if i can ask a second question, is it possible to have said picture in a cell in the list box as well

Thanks
Chris

Check out http://documentation.xojo.com/index.php/Graphics.DrawPicture. The function has many parameters.

Image is the picture you want to draw
x and y are the width and height of the picture you want to draw
DestWidth and DestHeight are the width and height of your canvas

So if you have an image of 1000x1000 and want to draw this to a canvas that is 300x300 your code is DrawPicture Image, 1000, 1000, 300, 300.

There are also finished solutions available if you want to buy and not learn. piDogScrollingCanvas I think it’s called.

You may also want to consider using a method which scales a picture for you. This is probably easier if you want to maintain the aspect ratio.

Thanks

That would be

DrawPicture image, 0,0,300,300, 0,0,1000,1000