473,911 Members | 5,861 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 12174
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
2378
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
2314
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
6690
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 make it the 0 index image, however, this makes an ugly space. Would I have to create my own...
0
2573
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 example is given for a Button control.
7
2111
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 images displayed next to the nodes during runtime. I tried creating nodes during designtime using...
0
2891
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
3972
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
2449
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, this simple example will not compile and run. It throws an unhandled exception in the Form's...
0
1218
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 changes to other parts of the project - and the icons disappeared for good! I can rebuild my...
0
10038
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9879
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10541
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9728
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8099
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7250
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5940
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4776
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

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.