0

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.

mrtaikandi
  • 6,753
  • 16
  • 62
  • 93

1 Answers1

1

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

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • 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. – mrtaikandi Dec 13 '09 at 15:27
  • 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 Dec 13 '09 at 15:45