Adding Images to ListView Subitems

M

Mark Doggett

Hi

I have a listview control with four columns. The problem
I have is that the second column needs to display an
image but as it is a subitem this doesn't appear to be
able to be done. Does anyone have any suggestions.

Thanks
 
J

Jeffrey Tan[MSFT]

Hi Mark,

Thanks for posting in this group.
For your question, I think there is not a suitable property for you to set
image to the listview subitem.
I think you should do the owner draw yourself.
While .Net does not expose the function for you to customize owner draw,
you have to P/invoke the Win32 way of handling owner draw.
When owner draw happens, there will be WM_NOTIFY with NM_CUSTOMDRAW sent.
You should hook this message, and the message's lParam points to the
NMLVCUSTOMDRAW structure(can be find in platform sdk document). You can
check its iSubItem field, to do cutomize owner draw to certain subitem.

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Mark Doggett" <[email protected]>
| Sender: "Mark Doggett" <[email protected]>
| Subject: Adding Images to ListView Subitems
| Date: Tue, 11 Nov 2003 07:37:07 -0800
| Lines: 8
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOoaapJo8/IZV2nTiq/P4ybFDcjdw==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:198388
| NNTP-Posting-Host: TK2MSFTNGXS01 10.40.2.125
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi
|
| I have a listview control with four columns. The problem
| I have is that the second column needs to display an
| image but as it is a subitem this doesn't appear to be
| able to be done. Does anyone have any suggestions.
|
| Thanks
|
 

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