How to set DrawFocusRectangle()?

  • Thread starter Thread starter Peder Y
  • Start date Start date
P

Peder Y

How can I set e.DrawFocusRectangle() correct in an owerdrawn
multiselect listbox?

I do all my drawing (e.g. OnMouseMove) calling OnDrawItem and
constructing the DrawItemEventArgs. The problem is that I never know
exactly when to draw the focus rectangle. The DrawFocusRectangle()
method is always called, but keeping track of which DrawItemState
needed to pass is hard work. I have a gut feeling this can be done
easier, but don't know how. It seems redundant that I will need to
pass on every time a mouse click is done or arrows or pgup/dn/home/end
etc are pressed. This info must be kept somewhere in the listBox, I'm
sure.

- Peder -
 
....when I invalidate the control, the win API kicks in and draws the
focusrectangle as it should be. Unfortunately, this is not an option
since it will cause a lot of flicker. I simply (?) need something to
test on (like an ideal Item.focused), so I can pass the proper
DrawItemEventArgs. Surely, someone must have bounced into problem
before...

- Peder -
 
Back
Top