Roman

Roman

  • NA
  • 1
  • 0

TreeView control with ImageList

Feb 22 2007 6:41 AM
Hello,

I need a TreeView control with images associated to each line. I've create both the TreeView control and the ImageList. I also added three pictures into the list in the designer mode and finally I associated an image index with particular tree lines. If I run the code on my machine I have no problems, however, If I run the code on different machine, it throws an exception in initialization, particularly on the last of following lines:

this.IconImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject( "IconImageList.ImageStream" )));
this.IconImageList.TransparentColor = System.Drawing.Color.Transparent;
this.IconImageList.Images.SetKeyName( 0, "UserIcon.gif" );
this.IconImageList.Images.SetKeyName( 1, "group.gif" );
this.IconImageList.Images.SetKeyName( 2, "UserIconOff.gif" );

Strange (at least for me) is, that it crashes on the third SetKeyName call, not those two before ... but those images have been added the same way. Anyway, I tried to add those images to the project resources, to the form resources, to special resources folder i've created, I tried to set them to be Linked, to be Embedded, to be copied in the build folder ... I tried almost everything, but it still keeps crashing :( Does anybody here know, how to do this simple task properly? (I would really think this to be rather intuitive, so maybe I just did one stupid thing and all is screwed up :( )

thanks in advance for any comment

//rem


Answers (1)