views:

173

answers:

1

Hi guys,

Is there any way to set the bounds of a all ListView items in LargeIcon mode to a specific size?

I want to manually draw a rounded rectangle background for each of the items, but in the DrawItem event e.Bounds differs based on the state of the items.

Thanks.

+1  A: 

Use SystemInformation.IconSpacingSize to discover the size of the grid square used to arrange icons in LargeIcon mode.

Hans Passant
Thanks for your answer, but here is another problem: When the item state is "Selected" e.Bounds of the DrawItem event is set to a different size and if I fill a rectangle with the size that I retrieved from SystemInformation only the size that e.Bound is set to will be painted.
Mohammadreza
Yes, the icon text for a selected item is allowed to be longer than 2 lines of text. I think your problem is that the clipping region will be set to e.Bounds, you can't draw outside of the bounds. I don't see an obvious workaround for this.
Hans Passant