Image Resizing


John Clarke
I have created an image object on my screen. I have set the size to a specific specification (Height 24, Width 24) and added a border by setting the border style to 1. However, when it is displayed it seems to be scaling the image depending upon the size of the screen. How can I stop this from happening ?

Amin Mousavi
Hi John,

For height and width I suggest assigning a class to your object and use "vw" for your width and set height to auto. In the below example width of your picture regardless of the size of the phone will take 40% of the "viewable width" and height will be defined accordingly. Depending on your design you can assign a size to height and set width to auto. You also can use "vh" or "vw" for the height if you wish. From the top of my head, I think auto does not work properly all the time, so you might perhaps use the second class since your picture's height and width are equal.


Regards

DecSoft

Hello to all,

In addition to the Amin's suggestion (thanks for that, sir, I really appreciate it), maybe it's important to know also the context in which we use the image. For example, if we are using an Image control of AB, or if we use an IMG HTML tag inside an HTML control of AB. You can take a look at the "Images" sample.

In principle we can use CSS and / or Javascript if it's required to deal with some specific image or images. But maybe a bit more information about how that image must be used (where, etc.) can be good too.


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.