Assign ImageList to Toolbar at Runtime

  • Thread starter Bruce Vander Werf
  • 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
 
J

James

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.
 
B

Bruce Vander Werf

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

--Bruce
 
R

RAVI KRISHNASWAMY [MSFT]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top