views:

190

answers:

1

I'm trying to manually draw ListViewItems on a Custom UserControl. The control itself is a wrapper around a ListView stored as a private member on the class.

There is a DrawListViewItemEventHandler attached to allow manual drawing for these items, and for the most part this seems to work. The problem I have is where the text for the ListViewItem (in large image mode) is long.

I'm drawing a bounding rectangle around the ListViewItem with various themes, and I then measure the size of the text using Graphics.MeasureString() and manually draw the text. However what I'm finding is that the vertical drawing is cropping at 2.5 lines of text, because the caption is falling outside of the VisibleClipBounds of the graphics context I have been passed.

It seems a bit of a strange but I'm not sure why such a thing should happen and can't figure out how to get around the problem.

A: 

You could use Tile view and TileSize to give yourself enough space to draw your text.

The ListView can't guarantee to draw all its text: the text could be huge.

Grammarian