473,395 Members | 1,637 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,395 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 2348
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.