Hello,
I have three UltraWinGrids stacked vertically, and I'd like to make them synchronous so that they can act as if they were one grid.
I have one horizontal scrollbar that appears on the bottom of the last grid, and I'd like to make all three grids scroll synchronously when I move the scrollbar.
I am currently scrolling them by using the AfterColRegionScroll method and assigning the last grids' ColScrollRegions[0].Position to the other two grids. This works, but there appears to be some lag between the grids even after calling Refresh() on all the grids.
Is there a way to diminish this lag?
Thank you in advance!
Hi Tatiana,
Thank you for posting in our forums!
Presumably by moving the vertical scrollbar of the UltraGrid you mean via holding the left mouse down key and releasing it. Indeed, I am able to see the lag you reference to, but a synchronization between more than two grids on such an event that requires the entire layout to be redrawn immediately for all grids is a complicated task and no further optimizations can be done in this scenario.
However, you have a decent option here. By default, the horizontal scrollbar doesn’t react on mouse wheel and also it doesn’t have the differed type of scrolling as the vertical scrollbar. Scrolling the horizontal scrollbar can be achieved by handling the mouse wheel event. Also I added precondition for Shift key to be pressed, in order for the UltraGrid to distinguish between scrolling the horizontal scrollbar instead of the vertical one. The differed type of scrolling can be achieved via handling mouse down and mouse up events. UltraGrid has BeginUpdate and EndUpdate methods that enable and disable the painting of the control itself.
Implementing the above functionalities adds consistency between the horizontal and the vertical scrollbars in case when both scrollbars are visible. In addition, no lag can be noticed when the scrolling is implemented in such a way.
Please take a look at the attached sample application and let me know if you need further assistance regarding this matter.
Thank you for your post Ivaylo!
Is there a way to keep this effect while having the horizontal scrollbar move with the mouse?
Thanks in advance.