Owner drawn listview control
6 November 2004 in .Net | Comments disabled

Over the last week I’ve been battling with converting a VB version of an ower-drawn listview to C#.

The benefits of the code I’m trying to convert is that it supports displaying thumbnails in the listview – something missing from even the .net 2.0 listview control (Note: I’m not interested in just setting the icon size to 100 or whatever and loading an imagelist and setting the listview.View.LargeIcons – that’s not efficient enough and will require all sorts of ugly hacks).

So anyway, I’ve altered the original code quite considerably and finally managed to get it somewhat working. I say somewhat working because it’s not actually displaying the thumbnails, but it’s a million miles ahead of where I was. My current problem seems to be that the dwItemSpec value that I’ve pulled from the Message gives massive numbers, like 758437504. This causes problems as that’s meant to be the index of the listview item. Obviously I don’t have close to a billion list view items, I only have 9, so it never gets to doing the custom draw due to it always thinking the current item is out of view.

I’ll keep going at it and see how I get on. The code works pefectly in VB, so I’ll build that and decompile that to see if it gives me any help.

The custom listview I’m attempting to duplicate is the one that ships with the FotoVision sample smart client application from the MSDN Smart Client site. Well worth a look at for anyone who enjoys winforms development.

- JD


Comments are closed.