D2 Treeview 'State Image' problem

I'm using  the Treeview component in D2 and trying to display a state image
next to the standard image for some nodes in the tree.  I'm assigning the
node's StateIndex in the treeview's OnGetImageIndex event-handler.  This
part of my code seems to be called as expected but the state image doesn't
always appear in the tree.  It seems to be a refresh problem; all I need to
do is resize the form that contains the treeview, without touching the
treeview itself, and the state icon will appear next to the node!  I've
tried calling the form and the treeview's 'Refresh' and 'Invalidate'
methods at various points in the code but it doesn't fix the problem.  Any
ideas?

Thanks

--
Andrew Jackson
ajack...@cccgroup.co.uk