How to suspend redrawing while changing e.g. column widths?

Posted by: jonasp on 8 September 2017, 2:52 pm EST

  • Posted 8 September 2017, 2:52 pm EST

    I've got a bit of a problem which is causing some flickering.

    At one point I save the column widths and at another point I restore the original column widths, starting from the leftmost column and then to the right.

    Lets say that the user has resized the columns to

    A: 50 px

    B: 100 px

    C: 100 px

    And then I restore it to: 

    A: 100 px

    B: 50 px

    C: 50 px

    The total width is the same and there shouldn't be any scroll bars displayed.

    It's just that when I resize A the total width will be 100 + 100 + 100 and a scrollbar will appear. Then I proceed with resizing the other two columns and the scrollbar goes away. It's all giving a nasty flickering sensation.

    I've tried doing a spread.SuspendLayout() and then resume when done but it still redraws while changing the individual column widths.

    I even tried doing it the hard way and calling win32 SendMessage(spread, WindowMessage.WM_SETREDRAW, 0);  and then restoring redraw when finished but the spread still redraws while resizing the columns.

    I got quite a lot of places where similar things are done and many of the spreads used has some flickering at some point caused by ditto operations. 

    How do I completely suspend the redrawing of the spread until I'm done resizing?  

  • Replied 8 September 2017, 2:52 pm EST

    you could set

    fpSpread1.HorizontalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.Never;

    then when you are done

    fpSpread1.HorizontalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded;

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels