How to show several images with different aspect ratio? #2996
-
I am writing the GUI software on WIN 11 with Rust, thus I have different kinds of images to show, with different aspect ratio, how I lock the aspect ratio to show the images.
Well, if I just write the width, some of the images shows right, but with a long image, the height is much bigger than the rectangle.
How do I fix that? anyone can help? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 11 replies
-
Here is a link to Slintpad with a demo code snippet. I used the SLint logo, which is wider than it is high, but the same applies in the other direction, too. If you remove the When you constrain both width and height, then the image will be trimmed down to fit into the assign space. Note that I had to specify |
Beta Was this translation helpful? Give feedback.
@Frank1126lin: Add
image-fit: contain;
into theImage
in yourPhoto
.Slintpad