//首先添加 Scroll事件
//同步滚动 private void dgYY_Scroll(object sender, ScrollEventArgs e) { if (this.dgFee.RowCount > 0) { dgFee.FirstDisplayedScrollingRowIndex = Math.Min(dgYY.FirstDisplayedScrollingRowIndex, this.dgFee.RowCount - 1); dgFee.HorizontalScrollingOffset = dgYY.HorizontalScrollingOffset; } } //同步滚动 private void dgFee_Scroll(object sender, ScrollEventArgs e) { if (this.dgYY.RowCount > 0) { dgYY.FirstDisplayedScrollingRowIndex = Math.Min(dgFee.FirstDisplayedScrollingRowIndex, this.dgYY.RowCount - 1); dgYY.HorizontalScrollingOffset = dgFee.HorizontalScrollingOffset; } }