Custom drawn listview issues

Bth505

New member
Joined
Mar 2, 2007
Messages
4
Programming Experience
5-10
I've created custom drawing handlers for a listview box. The source follows the msdn examples almost exactly and for the most part works like it should. The problem I'm having is the subitem text disappears when the item is moused over. The behaviour seems to be quite random, but happens a lot more frequently when the selected item is out of view. The listview is using full row selection, multiselection, and double buffering if any of that matters. Also the drawing code is available below. Any ideas what could be the cause of this?



Source: http://rafb.net/p/mK0zfY13.html
 
Try commenting out the lines as shown below..

VB.NET:
'If (ListView1.View = Windows.Forms.View.Details) Then
            e.DrawText(TextFormatFlags.LeftAndRightPadding)
   '     End If

Also, how have you enabled double buffering? Have you tried it with doublebuffering turned off?
 
Its set with a partial class in the initalizecomponents procedure. But it still occurs when double buffering is off, just flickers like crazy when I scroll then. Calling drawtext outside of the if/then statement didn't help either. It only does it with the 2nd column on, the first ones always visible.
 
Last edited:
Thanks found the solution there. I had missed the invalidation on mouse move which fixed it mostly. The items kind of flicker now when moused over. Not nearly as annoying as a whole screen full disappearing but can that be stopped?
 
Thing is i wouldn't do this with a partial class so it's difficult so say exactly what is going on here. If i were to do something like this then i would create a control that derives from the list view. Anywaymwhat do you do to 'make the whole screen full disappear'? and when does it occur?
 
Just mousing over them would cause the subitems to disappear. Then not come back until you either selected a new item or scrolled. So if you hit every item a whole screen might get axed. Now the subitems just vanish briefly but its not overly noticable.
 
Back
Top