Recent

Author Topic: Does TImage have scaling for PNGs?  (Read 199 times)

AMJF

  • New Member
  • *
  • Posts: 14
Does TImage have scaling for PNGs?
« on: April 15, 2021, 09:33:54 am »
I'm writing a program that shows PNG thumbnails on the right of a TListBox, but the images are too big and so I'm wondering if there is any basic scaling options to reduce the size, preferably to fit in the confines of the TImage control and not have the image expand out beyond the edges of my TForm?

wp

  • Hero Member
  • *****
  • Posts: 8402
Re: Does TImage have scaling for PNGs?
« Reply #1 on: April 15, 2021, 10:53:08 am »
Will the images be inside the Listbox, i.e. at the right of each item? In this case you should owner-draw the items and paint the images  by Listbox.Canvas.StretchDraw.

If the images are outside the Listbox in instances of TImage you should size the TImage components as you need and then put their property Proportional to true - the latter scales the images proportionately to fill the component in an undistorted way.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

 

TinyPortal © 2005-2018