这一点可以模仿Excel的做法,在点击滚动条上的按钮时动态改变行列数,比如点击水平滚动条的【向右】按钮或者垂直滚动条的【向下】按钮:
- private void Form1_Load(object sender, EventArgs e)
- {
- fpSpread1.ActiveSheet.RowCount = 50;
- fpSpread1.ActiveSheet.ColumnCount = 20;
- fpSpread1.HorizontalScrollBar.ButtonClick += new FarPoint.Win.Spread.FpScrollBarButtonClickEventHandler(HorizontalScrollBar_ButtonClick);
- fpSpread1.VerticalScrollBar.ButtonClick += new FarPoint.Win.Spread.FpScrollBarButtonClickEventHandler(VerticalScrollBar_ButtonClick);
- }
- void VerticalScrollBar_ButtonClick(object sender, FarPoint.Win.Spread.FpScrollBarButtonClickEventArgs e)
- {
- if (fpSpread1.GetViewportBottomRow(0) == fpSpread1.ActiveSheet.RowCount)
- {
- if (e.Button.ChangeType == FarPoint.Win.Spread.ChangeType.SmallChange)
- {
- fpSpread1.ActiveSheet.RowCount += 1;
- }
- }
- }
- void HorizontalScrollBar_ButtonClick(object sender, FarPoint.Win.Spread.FpScrollBarButtonClickEventArgs e)
- {
- if (fpSpread1.GetViewportRightColumn(0) == fpSpread1.ActiveSheet.ColumnCount)
- {
- if (e.Button.ChangeType == FarPoint.Win.Spread.ChangeType.SmallChange)
- {
- fpSpread1.ActiveSheet.ColumnCount += 1;
- }
- }
- }
复制代码
6015_Scroll.zip
(10.17 KB, 下载次数: 92)
|