Problem with Toolbar and ImageList

  • Thread starter Thread starter Xarky
  • Start date Start date
X

Xarky

Hi,
I am writing a windows application. To my form I have added a
ToolBar componenet and have created a collection of buttons within it.
I have also created an ImageList, where I have loaded the collection
of images into this component.

In the toolbar component I set the ImageList property with the the one
created. In the collection of buttons of the same toolbar, I start to
index the buttons with images. In the design view the images are
visible on the icons, but when I execute the application, no images
are seen.

Can someone help me out.
Thanks in Advance
 
hi,

weird indeed, it should work fine,
do this, debug the app and see if the ImageList is initialized and if the
images are loaded, the images by defualt are compiled as resources inside
the .exe

this code should be inside InitiateComponent() method.

I cannot think of any other possible cause

cheers,
 
Hi,
I added in the Windows Form Method I added the following,

toolBar1.ImageList = imageList;
toolBarButton1.ImageIndex = 0;
toolBarButton2.ImageIndex = 1;
..etc
toolBar1.Refresh();

and now they can be seen in the executed program.

I checked the "Windows Form Designer Generated Code" and that code
snippet as shown above is there, but it still won't work as supposed.

Its really strange :S
 
Back
Top