How to replace an image in TSpeedButton with another image in an ImageList?

1.7k views Asked by At

In my program, the image of SpeenButton set by imagelist. I need the image change with another image in the imagelist, when I click the speedbutton. How can I do that?

1

There are 1 answers

0
Uwe Raabe On

In case you are talking about VCL TSpeedbutton, you can place a TActionList on your form and connect it to your TImagelist. Then create an action in the actionlist, set its ImageIndex to the desired image. Now connect the TSpeedbutton to that action. In the OnExecute event of the action change the actions ImageIndex property to the new value. The speedbutton now shows the new image.