C1FlexGrid双grid滚动条联动

利用AfterScroll事件,来实现双grid联动。

1  private void Grid_AfterScroll(object sender, RangeEventArgs e)
 2  {
 3      try
 4      {
 5          if (!_Interlocking)
 6          {
 7              // スクロール連動の排他的制御
 8              _Interlocking = true;
 9
10              FlexGridFMS grid = sender as FlexGridFMS;
11              grid.Update();
12              Point pt = grid.ScrollPosition;
13
14              // 横のみ連動させる
15              if (grid.Equals(grdData))
16              {
17                  grdDataSub.ScrollPosition = new Point(pt.X, grdDataSub.ScrollPosition.Y);
18              }
19              else if (grid.Equals(grdDataSub))
20              {
21                  grdData.ScrollPosition = new Point(pt.X, grdData.ScrollPosition.Y);
22              }
23
24              this.Invalidate();
25              this.Update();
26
27              _Interlocking = false;
28          }
29      }
30      catch (Exception ex)
31      {
32          ErrorProc(ex);
33      }
34  }
(0)

相关推荐