Assign button to open a picture

Hi, I’m trying to get the user press any button of their Choice and once pressed it will show the image above.

. I would appreciate some help. Thanks

What do you have so far on you test project. A Button only? Do you want to pop the image up on a Canvas within your app or have the app just open the image in say your preview (Mac?)


Hey Mike,
Thanks for replying. This is what I have

. Even the pictures I’m trying to insert can’t fit in.

No within the app actually

Ok assuming those boxes are Canvases.

Create a Picture in your IDE and use the 1x and 2x image sizes.

// CANVAS #1
Var w1 as Double = g.width
Var h1 as Double = g.height
Var thisImage as Picture = YourPicture // <------- Use your picture here
Var xPos as Double = 0
Var yPos as Double = 0
Var sx as Double = 0
Var sy as Double = 0
Var w2 as Double = thisImage.Width
Var h2 as Double = thisImage.Height
g.DrawPicture(thisImage, xPos, yPos, w1, h1, sx, sy, w2, h2)

This will scale your picture to fit the actual dimensions of your canvas on your screen. So if you make your canvas larger or smaller your picture will scale.

Remember to use higher resolution images as this will scale down your image and it will look nice. However if you use a very small resolution image it will look grainy.


Sorry if I don’t understand certain stuff, I’m using this as an alternative of visual studio. So just IDE not an event handler function

What are you using for your pictures above? Canvas or ImageWell?


Ok im making you a test project.

Ok thanks.

Thanks Ivan that could be of a big help

Look at the Canvas.Paint events for each one of the canvas items. You will see what I did and how we introduced the picture’s to the project in the IDE.

On it

It fits properly

Can I now incorporate this into mine ?


How is it going @Ben_Namid?

Hey mike,
Sorry I was busy with an exam