Preventing ListBox.CellBackgroundPaint from firing

It seems that dragging over cells in a ListBox continuosly fires the CellBackgroundPaint event of this listbox.
Regarding that I’m using the event to draw images in the cell (it may take a few ms each paint), I would prefer to include specific calls to InvalidateCell in the DragOver event only if needed and disable the automatic firing.
Is this possible?

Set a boolean flag in your window (i.e. allowRedraw) and wrap your CellBackgroundPaint code in

If allowRedraw Then //do the drawing End if

[quote=412602:@Roger Clary]Set a boolean flag in your window (i.e. allowRedraw) and wrap your CellBackgroundPaint code in

If allowRedraw Then //do the drawing End if[/quote]
Just to be clear, if you don’t paint the contents, they’ll be blank if you do that.

I have been making some tests and noticed that after removing Accept…Drop from the open event dragging is smooth and CellBackgroundPaint doesn’t fire, my dragpicture shows but logically drop doesn’t works.

I may also activate Accept drop for other types (files, rawdata, etc) but not for the specific type being dragged. In case the dragitem data type matches the accept one, dragging over fires continuosly the paint event.

That means listbox is checking dragitem data each time it enters a cell or moves and for some reason activating the event if type matches.

I have submitted a case with an example project:
<https://xojo.com/issue/53995>