473,545 Members | 529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ImageList with ListView and TreeView

Ian
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 populated either
using VS.NET (my method) or programatically .

I assigned the imagelist to the small icons in the listview.

Even VS.NET has been satisfied with what I'm doing as it shows the
listitems/treenodes with icons. As soon as I build/run however, all
icons are missing.

One thing to note is I had originally extended a standard list, added
the images using the extended class (using the very same listview) and
it worked. Unfortunately, a list isn't powerful enough for my
purposes.

I've spent 10 hours (prob more) trying to fix this. I've installed all
possible patches, examined my code line-by-line. Tried to reproduce
the .net API examples. Nothing.

Has anyone had a similar issue? If so - Please help... please?
Nov 15 '05 #1
3 12160
Hi,

Sounds really weird, the only thing that comes to my mind is that when you
use WinXP, you should call Application.DoE vents prior to calling
Application.Run (). You can find more on this in the "Applying Windows XP
Visual Styles to Windows Forms Applications" topic in MSDN.

To quote the article:

<quote>
Note If one of the controls on your form is an ImageList control, be sure
to include the following line of code before calling Application.Run ().

// C#
Application.DoE vents();
</quote>

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ian" <he******@hotma il.com> wrote in message
news:e7******** *************** ***@posting.goo gle.com...
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 populated either
using VS.NET (my method) or programatically .

I assigned the imagelist to the small icons in the listview.

Even VS.NET has been satisfied with what I'm doing as it shows the
listitems/treenodes with icons. As soon as I build/run however, all
icons are missing.

One thing to note is I had originally extended a standard list, added
the images using the extended class (using the very same listview) and
it worked. Unfortunately, a list isn't powerful enough for my
purposes.

I've spent 10 hours (prob more) trying to fix this. I've installed all
possible patches, examined my code line-by-line. Tried to reproduce
the .net API examples. Nothing.

Has anyone had a similar issue? If so - Please help... please?


Nov 15 '05 #2
Ian
THANK YOU!

THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU!
THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU!
THANK YOU! THANK YOU! THANK YOU! ... THANK YOU!

Your suggestion worked!

Of course, it's always something simple like that :| 25 hours on one
little problem and it comes down to 30 odd characters of text!

Once again, thank you. I honestly thought no one would know what the
problem was - let alone care.
Nov 15 '05 #3
Ian,

I am really glad my suggestion has worked! Also keep in mind that, on WinXP,
the format to which ImageLists are serialized when stored in resource files
is *different* to that on Win2K and earlier versions.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ian" <he******@hotma il.com> wrote in message
news:e7******** *************** ***@posting.goo gle.com...
THANK YOU!

THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU!
THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU! THANK YOU!
THANK YOU! THANK YOU! THANK YOU! ... THANK YOU!

Your suggestion worked!

Of course, it's always something simple like that :| 25 hours on one
little problem and it comes down to 30 odd characters of text!

Once again, thank you. I honestly thought no one would know what the
problem was - let alone care.


Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2360
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")) TV.ImageList = ImageList1 Dim rootNode As New TreeNode("Test", 0, 1) rootNode.Text = "TEST"
2
2299
by: Bob C. | last post by:
Hi All, I am using the ImageList/ListView Components to display around 100 images in C#.NET. The issue i have is, some times i may need to display the thumbnail of size more then 256x256 in ImageList. But the ImageList Component supports only size upto 256x256. What is the best way to handle this?
1
6667
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 adding a ImageList to the TreeView, the ImageIndex property of the items in the TreeView defaults to 0. I could put a blank icon in the ImageList and...
0
2554
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 32-bit alpha-blended icon on a WinForm control. According to the article a workaround exists (overriding the controls' paint event handler) and an...
7
2089
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 treeview control set to the imagelist containing the images I want to be displayed next to each node. It seems that no matter what I do there will be no...
0
2827
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 SHFILEINFO Public hIcon As IntPtr ' : icon Public iIcon As Integer ' : icondex Public dwAttributes As Integer ' : SFGAO_ flags
2
3956
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 file I am adding the icon to the imagelist and then use its position to display the icon in the listview.
0
2424
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 set the TreeView ImageList property to the ImageList component and observe the expected results in the TreeView as displayed in the IDE. However,...
0
1189
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 working, and it did display a folder or document icon from the ImageList next to each item in the treeview and listview controls. And then I made some...
0
7398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7416
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7752
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1878
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
701
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.