Progressbar in listview

J

John Rogers

Does anyone have any sample code that shows how to
place a progressbar into a listitem in the listview?
I have seen two articles on codeproject, but the code
is so complex that I can't even rip the code out to use
it in just a regular listview.

Does anyone have a simple snippet of code that does that?



Thanks

John-
 
N

Nicholas Paldino [.NET/C# MVP]

John,

There aren't many options here when working with a ListView in Windows
Forms. You can either a) repaint the whole control yourself, or b) overlay
the control on the ListView in the appropriate place.

However, both are really intense hacks (as you have seen) which are not
easily maintainable.

If you have the option to use Windows Presentation Foundation, you might
want to consider using the ListView there, as it will allow you to composite
the display for the individual items in the ListView any way you wish,
including embedding controls for each item fairly easily.
 
J

John Rogers

I was just looking at something in the code again, this part
of the code I don't know how to implement.

protected override void WndProc(ref Message m)
{
switch (m.Msg)
{


What would I have to do to utilize this WndProc()? If I
can have an example that would get me one step closer.


Thanks


John-
 
N

Nicholas Paldino [.NET/C# MVP]

John,

Well, I assume this is in a class that derives from ListView, right? If
so, then what you are doing is fine.

The question is, ^how^ do you want to utilize it? The WndProc method is
called to respond to Windows messages and process them accordingly.
 
J

John Rogers

Nicholas,

I got all the code pasted and working. I was looking at the WndProc() and
didn't
see where it was being called, so I was a bit confused about that. I now
have all
the code pasted and all the errors gone. When I generate the progressbar,
it appears
on the first header of the listview. This is going to take some work
because I don't
want it on the header, what happened to the listitems.

Thanks for your help.

John-


Nicholas Paldino said:
John,

Well, I assume this is in a class that derives from ListView, right?
If so, then what you are doing is fine.

The question is, ^how^ do you want to utilize it? The WndProc method
is called to respond to Windows messages and process them accordingly.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

John Rogers said:
I was just looking at something in the code again, this part
of the code I don't know how to implement.

protected override void WndProc(ref Message m)
{
switch (m.Msg)
{


What would I have to do to utilize this WndProc()? If I
can have an example that would get me one step closer.


Thanks


John-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top