Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Toolbar's button image at rumtime? 1

Status
Not open for further replies.

JohnStep

Programmer
Apr 19, 2000
190
US
I have looked far and wide but cant get any answers. What is the best way to change a toolbars button image at runtime? Is there any way?

Thanks for any help in advanced

J Stephens
 
Yeah, it's just a matter of understanding the objects involved.

1. Your toolbar
2. Its buttons collection
3. Your imagelist
4. Its image collection

So, I'm assuming that you've been able to set up a toolbar with images on buttons. (Let me know if you haven't.) To change the image, just say
Code:
Toolbar1.Buttons(1).Image = 2
as an example, where the Image property was something other than 2 before. Keep in mind that both the buttons collection and the Image collection on the ImageList have a lower bound of 1, not 0. So, just add the different images that you want to the ImageList collection, and change the Image property of the Button appropriately.

HTH

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top