回复 1楼zhuliwangfen的帖子
你试试看下面的代码是否满足你的需求。
- int i, j; // i 表示能滚动的最后一行, j 表示能滚动的最后一列
-
- // 获取能滚动的最后一行和最后一列
- this.gcSpreadSheet1.ActiveSheet.ActiveColumnIndex = 99;
- this.gcSpreadSheet1.ActiveSheet.ActiveRowIndex = 499;
- this.gcSpreadSheet1.ShowActiveCell(GrapeCity.Windows.SpreadSheet.UI.VerticalPosition.Bottom, GrapeCity.Windows.SpreadSheet.UI.HorizontalPosition.Right);
- i = this.gcSpreadSheet1.GetViewportTopRow(this.gcSpreadSheet1.GetActiveRowViewportIndex());
- j = this.gcSpreadSheet1.GetViewportLeftColumn(this.gcSpreadSheet1.GetActiveColumnViewportIndex());
-
- private void gcSpreadSheet1_LeftColumnChanged(object sender, GrapeCity.Windows.SpreadSheet.UI.ViewportEventArgs e)
- {
- if (j!=0 &&e.NewIndex > j)
- {
- this.gcSpreadSheet1.SetViewportLeftColumn(this.gcSpreadSheet1.GetActiveColumnViewportIndex(), j);
- }
-
- }
- private void gcSpreadSheet1_TopRowChanged(object sender, GrapeCity.Windows.SpreadSheet.UI.ViewportEventArgs e)
- {
- if (i != 0 && e.NewIndex > i)
- {
- this.gcSpreadSheet1.SetViewportTopRow(this.gcSpreadSheet1.GetActiveRowViewportIndex(), i);
- }
- }
复制代码 |