Treeview and Imagelist

Roey

Junior Contributor
Joined
Oct 10, 2002
Messages
238
Location
Canada
Trying to draw a treeview, with different icons at each node populated from an Imagelist. I had this working really well in VB6 but can't seem to even load my images into the Imagelist in .Net. Any advice would be greatly appreicated.
 
Was using a recordset in my VB6 project and loading BLOB images through a routine called LoadImage

Set objCategory = New clsCategory

ImageList1.ListImages.Clear
ImageList1.ImageHeight = 32
ImageList1.ImageWidth = 32

Set rsGeneric = objCategory.All
rsGeneric.MoveFirst
Do Until rsGeneric.EOF 'If there are entries in the database
Call LoadImage(rsGeneric)
ImageList1.ListImages.Add rsGeneric("CatID"), rsGeneric("Description"), Image1.Picture
rsGeneric.MoveNext
Loop

I have worked out how to load BLOB images into a picturebox using the LoadImage subroutine, but can't work out how to move through the dataset and load the images into an Imagelist.
 
I am able to put the images into the ImageList but they never show correctly. They are extremely small!!
The first MessageBox (one I made, supports images) shows the image correctly. But when I put that image into the ImageList and then view it in the MB it is tiny and messed up.
C#:
B= (Bitmap)o;
a.MB.ShowDialog(B);
IL.Images.Add((Bitmap)o);
for(int i=0; i < IL.Images.Count; i++)
{
    a.MB.ShowDialog((Bitmap)IL.Images[i]);
}
I always use an ArrayList to do this sort of thing. I have to put the image from the ArrayList into a Bitmap before I can display it but it works.
 
Back
Top