Problem with Toolbar and ImageList

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
 
I

Ignacio Machin \( .NET/ C# MVP \)

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,
 
X

xarky d_best

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
 

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

Top