#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    16
    Rep Power
    0

    Reduce flickering on ListView resize


    Hi.
    I use a TNTListView to display some information. It's set to vsReport and it shows column headers.
    I set AutoSize to false to all the colums because I noticed that it's not working properly and I'm doing the column resizing programatically in the OnResize form event (in the listview event doesn't work).
    I divide ListView.ClientWidth to the Columns.Width (between Columns.BeginUpdate and Columns.EndUpdate).

    The problem is the ListView is flickering badly when I resize the form, especialy when I reduce it, because the horizontal scrollbar appears for a split second.

    Options:

    1. I can try to disable the horizontal scrollbar during form resizing (or completely). But I tried every fix found here and on the first 5 Google pages, NOTHING worked.
    2. Disable the listview anchors on form and resize it manually in the OnResize form event. The problem is I need a way to completely stop the listview from updating its interface (not just items or columns). This way it will update only after all the modifications are done but still change ListView.ClientWidth internally so I can use it to resize the columns. But I haven't found such way...
    3. Use other component. But I prefer to do this ONLY as a last,...last resort.

    Can you please help me find a better solution..?
    Thank you.

    Regards, DavidB
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    151
    Rep Power
    2
    Try setting the containing form's doublebuffered property to true.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    16
    Rep Power
    0
    Thank you.

    But I already tried it in form.oncreate (is on for months now) and I don't see any improvement with the listview, only with other components like BitBtn,SpeedButton...
    And listview.doublebuffered has no effect also.
    Oh, btw, sorry for not mentioning, I use Delphi 7.

    Regards, DavidB
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    344
    Rep Power
    6
    Possibly if you handle the WM_ERASEBKGRND message, flickering can be controlled. You can derive a new TNTListView component, use the source here as a guide on how to do so.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    16
    Rep Power
    0
    Thank you.

    You mean devising a new component with a sort of "manual made DoubleBuffered"...?
    That's a lot of work for just improving the resize...

    I'm thinking about keeping the image of the listview in a TBitMap and painting it on the listview canvas when it's necessary. Is it ok?
    The tricky part is how to know exactly when is necessary or not...

    Regards, DavidB

IMN logo majestic logo threadwatch logo seochat tools logo