I know it's not much help, but that code works fine for me in XPSP2, VB.net,
fw 1.1, with or without visual styles.
Here's the exact code I used to test:
\\\
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) _
Handles MyBase.Load
CreateBmps()
Dim ImageList1 As New ImageList
ImageList1.Images.Add(Image.FromFile("..\images\st atusOK.bmp"))
ImageList1.Images.Add(Image.FromFile("..\images\st atusKO.bmp"))
TreeView1.ImageList = ImageList1
Dim rootNode As New TreeNode("Test", 0, 1)
TreeView1.Nodes.Add(rootNode)
Dim childNode As New TreeNode("Test Child", 0, 1)
rootNode.Nodes.Add(childNode)
End Sub
Private Sub CreateBmps()
If Not (IO.File.Exists("..\images\statusOK.bmp")) Then
If Not (IO.Directory.Exists("..\images\")) Then
IO.Directory.CreateDirectory("..\images\")
End If
Dim bmp As New Bitmap(16, 16)
Dim g As Graphics = Graphics.FromImage(bmp)
g.Clear(Color.Green)
bmp.Save("..\images\statusOK.bmp", Imaging.ImageFormat.Bmp)
g.Clear(Color.Red)
bmp.Save("..\images\statusKO.bmp", Imaging.ImageFormat.Bmp)
g.Dispose()
bmp.Dispose()
Else
MessageBox.Show("Done already")
End If
End Sub
///
--
Mick Doherty
http://dotnetrix.co.uk/nothing.html