471,339 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,339 software developers and data experts.

imagelist problem with treeview and listview

Hi,

I've this code:

Dim ImageList1 As New ImageList
ImageList1.Images.Add(Image.FromFile("..\images\st atusOK.bmp"))
ImageList1.Images.Add(Image.FromFile("..\images\st atusKO.bmp"))
TV.ImageList = ImageList1
Dim rootNode As New TreeNode("Test", 0, 1)
rootNode.Text = "TEST"
TV.Nodes.Add(rootNode)

this works fine in win2003/win2000, but in XP, i cannot see the images in
the treeview. it occurs also in listviews

vb.net/fw1.1/ visualstyle enable

thanks for your help
Jul 21 '05 #1
2 2265
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
Jul 21 '05 #2
just one point i forgot to tell. it worked 1 month ago and one day no more
icons on XP

"Mick Doherty" wrote:
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

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Ian | last post: by
1 post views Thread by paradox | last post: by
reply views Thread by morten skrubbeltrang | last post: by
7 posts views Thread by Andrew Christiansen | last post: by
2 posts views Thread by sonu | last post: by
reply views Thread by gene kelley | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.