ListBox CellBackGroundPainting

XOJO 2019r3.2 - Windows Desktop

My program uses a ListBox to show the midi data of a midi file.
The ListBox has 10 columns, and there are 50 VISIBLE rows.
The CellBackGroundPainting is called 500 times i.e. for each row’s 10 column’s.

I was wondering if it would be possible to create my own ListBox with a CellBackGroundPainting that is only called only for each row.

If else : CellBackGroundPainting(g As Graphics, row As Integer) As Boolean

The idea is that perhaps I could gain some time. Not sure . I would like to test this.


But it doesnt keep firing , does it?

No it stops firing.
When I scroll it fires again the number of rows*Columns.

It only fires when it need s to draw something because tje contents have changed in some way
(Scrolled so the backs ground need to be redrawm in a now spot, inavlidated which is a manual way for you to say "redraw this when you can"m etc)
It minimizes the drawing as best it can and I really doubt drawing a row at one time will make much speed difference and will add a whole lot of complexity to your life
I’d profile the code and see IF cellbackgroundPaint IS a huge time sink as you suspect
If it is I would optimize the code doing the drawing of each cell