Recent

Author Topic: [Solved] Change Pictures During Run-time  (Read 3724 times)

puredeadoblivion

  • Guest
[Solved] Change Pictures During Run-time
« on: February 22, 2017, 05:48:54 pm »
Hi there,

I've been trying to make a form where during run-time a TPicture, will change directory to another picture (So that the picture changes based on certain requirements).

I have been so far unsuccessful in doing so. Please could someone please tell me how I would go about changing the TPicture? or if that is impossible if there is another method to changing the picture during run-time!

Thanks
« Last Edit: February 22, 2017, 09:37:57 pm by puredeadoblivion »

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Pictures
« Reply #1 on: February 22, 2017, 05:55:22 pm »
TPicture is not a visible component, but it's used by others like TImage. TPicture can also be drawn on any canvas and you can change it run-time using LoadFromFile procedure.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Change Pictures During Run-time
« Reply #2 on: February 22, 2017, 06:54:16 pm »
You could create a simple array of locations, as in the attached project.
An alternative is to use a TImageList. But I find that more hassle and more complicated to set up.

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: Change Pictures During Run-time
« Reply #3 on: February 22, 2017, 08:04:42 pm »
TImageList only supports fixed sized images. If you have files that have different dimensions, then you need to use other solution.

 

TinyPortal © 2005-2018