views:

33

answers:

1

Hello,

I was wondering whether it would be possible to have a ListView, in which items can be selected as usual with one difference. When a ListViewItem is selected, I would like to see the selection in the text label, however I would prefer the image to remain the same. The reason for this is, that currently the blue selection drawn ontop of the image looks horrible (the effect is even worse on transparent images!).

I was hoping of not having to use the DrawItem handler, but I guess the hopes are slim.

thanks a lot,

best

Frank

EDIT: I thought I better add a screenshot showing the issue. I'm using the ListView in LargeIcon mode.

** oups I'm not allowed to add pictures yet * so here the link to it. sorry for the inconvenience. *

http://cl.ly/adb9c6d29ffc0e2e1b5e

As you can see the selected element is 'Rate vs. Species'. However, I would love for the blue tint on the icon to disappear.

Thanks again.

+1  A: 

For a winforms ListView, the easiest way I'm aware of to do this would be to inherit from ListView, and override OnDrawSubitem to only change the drawing of your image. If you do this, you'll need to set OwnerDraw to true, and override OnDrawColumnHeader as well.

Note that if you don't want to inherit, you can handle DrawSubItem and DrawColumnHeader instead.

Philip Rieck
I'm sorry for not being more precise. I'm actually using the ListView in LargeIcon mode. I also have no subitems. I've added a link to a picture above. I still fear you are right, I might have to draw the ListViewItems myself, though I still would like to avoid it.
Frank
unfortunately as far as I can see, you're going to have to do it yourself. The eventargs has a good number of helpers on it that can let you use default behavior (like DrawText(), etc). or you can delegate to the base case and draw your image + background over the existing one.
Philip Rieck