cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FluffyLina
Regular Visitor

How do I make the image increase when I click on it?

Hello!
I created the screen as a tutorial. But all the images were too small. I would like the image to increase when you click on it. How can I do this? All images are uploaded using links from the Internet. I will be happy if you help

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @FluffyLina ,

Do you want to change image's size by clicking the image?

Actually, the image's size is decided by its height and width properties.

So you could set a variable by clicking the image and set the image's height, width based on this variable.

I've made a similar test for your reference:
1)set the screen's OnVisible:

Set(var,true)

2)set image's OnSelect:

Set(var,!var)

3)set image's height:

If(var,200,1000)

set image's width:

 

If(var,200,1000)

 

Set the image's image position to Fit.

 

Then at the beginning the image's size is 200*200, if you click the image, the image's size will become 1000*1000, if you click the image again, it will turn back to 200*200.

5124.gif

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @FluffyLina ,

The reason why the image only stretch  to the right, but not to the left, is that you do not change the image's X and Y property.

Please notice these two properties' defination:

X – The distance between the left edge of a control and the left edge of its parent container (screen if no parent container).

Y – The distance between the top edge of a control and the top edge of the parent container (screen if no parent container).

If you want to the image stretch to two sides, you not also need to change the image's height, width value, but also need to change the image's X and Y.

For example:

X:   If(var,350,350-Image3.Width/2)

Y:  If(var,190,190-Image3.Height/2)

 

To sum up ,you need to set the image's X and Y based on the layout that you want.

Here's a doc about how to set app's layout for your reference:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-responsive-layout

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yutliu-msft
Community Support
Community Support

Hi @FluffyLina ,

Do you want to change image's size by clicking the image?

Actually, the image's size is decided by its height and width properties.

So you could set a variable by clicking the image and set the image's height, width based on this variable.

I've made a similar test for your reference:
1)set the screen's OnVisible:

Set(var,true)

2)set image's OnSelect:

Set(var,!var)

3)set image's height:

If(var,200,1000)

set image's width:

 

If(var,200,1000)

 

Set the image's image position to Fit.

 

Then at the beginning the image's size is 200*200, if you click the image, the image's size will become 1000*1000, if you click the image again, it will turn back to 200*200.

5124.gif

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thank you, but can I do something that would stretch the image not only to the right, but also to the left?

Hi @FluffyLina ,

The reason why the image only stretch  to the right, but not to the left, is that you do not change the image's X and Y property.

Please notice these two properties' defination:

X – The distance between the left edge of a control and the left edge of its parent container (screen if no parent container).

Y – The distance between the top edge of a control and the top edge of the parent container (screen if no parent container).

If you want to the image stretch to two sides, you not also need to change the image's height, width value, but also need to change the image's X and Y.

For example:

X:   If(var,350,350-Image3.Width/2)

Y:  If(var,190,190-Image3.Height/2)

 

To sum up ,you need to set the image's X and Y based on the layout that you want.

Here's a doc about how to set app's layout for your reference:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-responsive-layout

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (69,181)