Assign ImageList to Toolbar at Runtime

  • Thread starter Thread starter Bruce Vander Werf
  • Start date Start date
B

Bruce Vander Werf

I am trying to assign an ImageList to a Toolbar at runtime. This is a
secondary form and I would like to use the ImageList from the main
form. The Toolbar is totally configured at design-time, with the
exception of the ImageList property.

So I create the form, assign the ImageList to a public variable on the
form, then on the OnLoad event, assign the ImageList to the Toolbar.
This doesn't seem to work - the buttons on the toolbar have no image.

What else do I need to do?

--Bruce
 
Hey,

I would suggest that the Toolbar has already been
rendered before the onload event is being passed to your
form.

Make the ImageList static and load it before you create
your form.

One question. If everything else is done at runtime, why
are you not setting the imagelist at runtime also?

James.
 
I want to share one imagelist with all my forms. I don't want to store
duplicate images if I can help it.

--Bruce
 
You need to reapply the image index of the toolbar buttons again. In the
native toolbar control, setting the image index of a toolbar button before
setting the imagelist of the toolbar is not supported.

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top