Recent

Author Topic: [SOLVED] Different pictures with different values  (Read 8232 times)

balazsszekely

  • Guest
Re: Different pictures with different values
« Reply #15 on: April 13, 2016, 01:15:09 pm »
For a TToolBar, TListView, TTreeView, etc I would use three separate TImageList. When the user change a color profile, just assign the appropriate TImageList to each control.
If this not the case, for example you have large images and you need them for a special reason, just zip the png's and store the zip as resource. When needed, extract the resource to a temporary folder then load each png according to your needs.

madref

  • Hero Member
  • *****
  • Posts: 1116
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Different pictures with different values
« Reply #16 on: April 13, 2016, 02:21:23 pm »
I also thought about using a TImageList. But there strands my knowledge.
How to get them from the TImageList to the TImage
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Main Platform:
--------------
Mac OS X Tahoe 26.2
Lazarus 4.99 (rev main_4_99-3149-g7867f6275c) FPC 3.3.1 x86_64-darwin-cocoa

Windows 10 Pro
Lazarus 3.99 (rev cbfd80ce39)

balazsszekely

  • Guest
Re: Different pictures with different values
« Reply #17 on: April 13, 2016, 04:00:27 pm »
Quote
How to get them from the TImageList to the TImage
In this case I would go with resources:
http://wiki.freepascal.org/Lazarus_Resources

wp

  • Hero Member
  • *****
  • Posts: 13363
Re: Different pictures with different values
« Reply #18 on: April 13, 2016, 04:08:44 pm »
How to get them from the TImageList to the TImage
Code: Pascal  [Select][+][-]
  1.   ImageList1.GetBitmap(Listbox1.ItemIndex, Image1.Picture.Bitmap);

When working with imagelists you must keep in mind that all images must be same size and that you must preset the ImageList properties Width and Height with the expected image width and height before adding any images to the list.

balazsszekely

  • Guest
Re: Different pictures with different values
« Reply #19 on: April 13, 2016, 04:12:01 pm »
@wp
GetBitmap keeps the transparency? The OP mentioned something about transparent png's.

PS: I'm only asking this because under delphi there was a component(TPngImages) which handled png natively.  I never worked with png and lazarus, at least not with transparent png's.
« Last Edit: April 13, 2016, 04:21:41 pm by GetMem »

wp

  • Hero Member
  • *****
  • Posts: 13363
Re: Different pictures with different values
« Reply #20 on: April 13, 2016, 04:45:04 pm »
Yes - look at the attached demo. The image list contains some png images with semitransparent shadow.

I do remember the times when I discovered TPngImages for Delphi and was suprised how beautiful the Delphi toolbars look with it. But Lazarus is even better - it just works out of the box.

balazsszekely

  • Guest
Re: Different pictures with different values
« Reply #21 on: April 13, 2016, 04:49:10 pm »
Ok, thanks @wp!

madref

  • Hero Member
  • *****
  • Posts: 1116
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: [SOLVED] Different pictures with different values
« Reply #22 on: April 16, 2016, 05:11:21 am »
Thanks for the help :D
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Main Platform:
--------------
Mac OS X Tahoe 26.2
Lazarus 4.99 (rev main_4_99-3149-g7867f6275c) FPC 3.3.1 x86_64-darwin-cocoa

Windows 10 Pro
Lazarus 3.99 (rev cbfd80ce39)

 

TinyPortal © 2005-2018