高手写的:
IDC_DGV_HOSTONLINETRACER.FirstDisplayedScrollingRowIndex =Math.Max(0, row.Index - this.IDC_PNL_GDV_HOSTONLINE_TRACE_INORMATION.VScrollBar.BMLargeChange / 2);
this.IDC_DGV_HOSTONLINETRACER.CurrentCell = (ite as OnlineTracerIterator).ElemCurr;
我写的:
int FirstDisplayRowIndex = this.IDC_DGV_HOSTONLINETRACER.FirstDisplayedScrollingRowIndex;
int CurrentRowIndex = this.IDC_DGV_HOSTONLINETRACER.CurrentRow.Index;
if ((CurrentRowIndex - FirstDisplayRowIndex) > MAX_ROW_COUNT_IN_ONE_PAGE / 2)
{
this.IDC_DGV_HOSTONLINETRACER.FirstDisplayedScrollingRowIndex = CurrentRowIndex - MAX_ROW_COUNT_IN_ONE_PAGE / 2;
}