PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV Mobile 2024 → Loading scaled images to buttons
Loading scaled images to buttons
Started by Stewart MICHAEL, Aug., 13 2016 6:09 PM - 1 reply
Posted on August, 13 2016 - 6:09 PM
I am loading pictures onto some buttons but although I can scale the images, when I load these to the button I only get a strip of the picture. Different sizes of picture will give me a different size strip. At first I thought I must be cropping the image rather than scaling it but if I load the same image to a image control then it is fine... blurry a bit but fine.

Any ideas appreciated as always.

img1 is Image = dLoadImage(Individuals.Photo)
xPHeight is numeric = img1..Height
xPWidth is numeric = img1..Width
xBHeight is numeric = {"BTN_"+sLoc}..Height*0.7
xScaleRatio is numeric = xBHeight/xPHeight
nWid is int = xPWidth*xScaleRatio
nHei is int = xPHeight*xScaleRatio

dResize(img1,nWid,nHei,drHomotheticExtended)
dEndDrawing(img1)
{"BTN_"+sLoc}..Image = dLoadImage(img1)
Posted on August, 16 2016 - 1:56 PM
Hi Stewart,

scaling is not image, you need to resize them to the EXACT size needed
(16px,24, 48, etc) depending on the button... Anything else will be
truncated

Also, you may need to save your image on disk before loading it in your
button, or change the ..width and ..height of the image variable (if
available)

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 8/13/2016 à 10:09 AM, Stewart MICHAEL a écrit :
I am loading pictures onto some buttons but although I can scale the
images, when I load these to the button I only get a strip of the
picture. Different sizes of picture will give me a different size
strip. At first I thought I must be cropping the image rather than
scaling it but if I load the same image to a image control then it is
fine... blurry a bit but fine.

Any ideas appreciated as always.

img1 is Image = dLoadImage(Individuals.Photo)
xPHeight is numeric = img1..Height
xPWidth is numeric = img1..Width
xBHeight is numeric = {"BTN_"+sLoc}..Height*0.7
xScaleRatio is numeric = xBHeight/xPHeight
nWid is int = xPWidth*xScaleRatio
nHei is int = xPHeight*xScaleRatio

dResize(img1,nWid,nHei,drHomotheticExtended)
dEndDrawing(img1)
{"BTN_"+sLoc}..Image = dLoadImage(img1)