I have an owner drawn TListBox (lbVirtualOwnerDraw), whose content gets updated dynamically (there can be as high as 10 updates in a second). There can be up to 300 items in the list box at a time. Each item may have about 5 lines of text and an image associated with it. Whenever an item is refreshed, I have to refresh (or invalidate) the TListBox so that the ListBoxDrawItem will be invoked by the VCL framework. But this adversely affects overall performance because of all the redundant repainting. So my question is:
Is there a way to invalidate only a small portion of the canvas which contains the drawing of one item or one of its parts? (e.g., rectangle containing one line of text or the bitmap).
How can we handle such a selective invalidate rectangle in Draw Item? If it were possible to pass an integer as part of the Refresh or invalidate I could use that in DrawItem to determine what to refresh.
Is there a way to find if an item is visible at all on a TListBox (by index)?
Thanks in advance!