473,224 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 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 2342
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ian | last post by:
Hi, I've been trying to create a listview and treeview with icons. You would think it's a pretty straight forward task. API documentation states you simply assign an ImageList - that's been...
1
by: paradox | last post by:
I want to have a TreeView that shows an image on some items, but not all. Basically, if a certain condition is true, a caution icon is placed next to the treeview item. The problem is that, by...
0
by: morten skrubbeltrang | last post by:
According to KB article 822488 http://support.microsoft.com/default.aspx?scid=kb;en-us;822488 visual c# .net 2002 + 2003 has bug in rendering of alpha channel information when displaying a...
7
by: Andrew Christiansen | last post by:
Hey everyone. I have Visual Basic .NET 2003 and am trying to show images on a treeview control. I have the imagelist on the form filled with images, and have the ImageList property of the...
0
by: Andre Viens | last post by:
Hello, I am using the following variation of code from <http://support.microsoft.com/default.aspx?scid=kb;EN-US;319340> to add icons to an imagelist for use in a listview: Private Structure...
2
by: brunchto | last post by:
Hi, I've this code: Dim ImageList1 As New ImageList ImageList1.Images.Add(Image.FromFile("..\images\statusOK.bmp")) ImageList1.Images.Add(Image.FromFile("..\images\statusKO.bmp"))...
2
by: sonu | last post by:
Hi, I have a problem for use of imagelist. The problem is I have written a code which returns me the icons associated with the files depending on their type. After getting the icon for the...
0
by: gene kelley | last post by:
(using VS2005) I want to add an icon to TreeView nodes. 1) To a new project (VB or C#) I add a sample TreeView with some sample nodes. I add an ImageList component, and add one icon image. I...
0
by: crealas | last post by:
I'm currently building a GUI in C# using Microsoft Visual Studio 2005. I have put together an Explorer style control as explained in the walkthrough in the Visual Studio 2005 help. I got it...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.