vb.net - Custom ListBox not scrolling properly with DrawMode.OwnerDrawVariable -


i made custom listbox change way drawn. i've set drawmode ownerdrawvariable, , have handled both drawitem , measureitem event.

when scroll down list box, appears scroll in wrong direction. ends in right place, animates incorrectly.

the problem seems related ownerdrawvariable, scrolls fine on ownerdrawfixed. necessary use ownerdrawvariable however. ideas?

private sub wraplistbox_drawitem(byval sender object, byval e system.windows.forms.drawitemeventargs) handles me.drawitem     e.drawbackground()     dim mybrush brush = brushes.black     if e.index mod 2 = 0         e.graphics.fillrectangle(brushes.lightgray, e.bounds)     else         e.graphics.fillrectangle(brushes.white, e.bounds)     end if     if (e.state , drawitemstate.selected)         e.graphics.fillrectangle(brushes.darkblue, e.bounds)         mybrush = brushes.white     end ifsettings.       e.graphics.drawstring(me.items(e.index), me.font, mybrush, new rectanglef(e.bounds.x, e.bounds.y, e.bounds.width, e.bounds.height))     e.drawfocusrectangle() end sub  private sub wraplistbox_measureitem(byval sender object, byval e system.windows.forms.measureitemeventargs) handles me.measureitem     dim g graphics = e.graphics     dim size sizef = g.measurestring(me.items.item(e.index).tostring, me.font, me.width - 5 - systeminformation.verticalscrollbarwidth)     e.itemheight = cint(size.height) + 5     e.itemwidth = cint(size.width) + 5 end sub 


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -