469,331 Members | 5,740 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,331 developers. It's quick & easy.

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 11955
Hi,

Sounds really weird, the only thing that comes to my mind is that when you
use WinXP, you should call Application.DoEvents 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.DoEvents();
</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******@hotmail.com> wrote in message
news:e7**************************@posting.google.c om...
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******@hotmail.com> wrote in message
news:e7**************************@posting.google.c om...
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bob C. | 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 zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.