The C1TrueDBGrid Scroll event always returns values prior to the scroll. If I don't have a way to fetch final values, we simply can't synchronize another grid's scrollbar with the main C1TrueDbGrid. However, we can still outsource the job to a delegate invoked from within the C1TrueDbGrid's Scroll event.
public delegate void InvokeDelegate();
object ActiveGrid;
private void c1TrueDBGrid1_Scroll(object sender, C1.Win.C1TrueDBGrid.CancelEventArgs e)
{
ActiveGrid = sender;
//Invoke delegate to create sync between grids.
this.BeginInvoke(new InvokeDelegate(SyncGrids));
}
private void SyncGrids()
{
foreach (Control ctrl in this.Controls)
{
//Set Horizontal and Vertical offsets of the second grid equal to the main grid.
if ((ctrl) is C1.Win.C1TrueDBGrid.C1TrueDBGrid)
{
(ctrl as C1.Win.C1TrueDBGrid.C1TrueDBGrid).Splits[0].HorizontalOffset = (ActiveGrid as C1.Win.C1TrueDBGrid.C1TrueDBGrid).Splits[0].HorizontalOffset;
(ctrl as C1.Win.C1TrueDBGrid.C1TrueDBGrid).Splits[0].VerticalOffset = (ActiveGrid as C1.Win.C1TrueDBGrid.C1TrueDBGrid).Splits[0].VerticalOffset;
}
}
}