打开
- this.fpSpread1.AllowDragFill = true;
复制代码
可以拖拽复制单元格的值。
在如下事件中进行自增处理
- this.fpSpread1.DragFillBlockCompleted += fpSpread1_DragFillBlockCompleted;
复制代码
示意代码如下:
- void fpSpread1_DragFillBlockCompleted(object sender, FarPoint.Win.Spread.DragFillBlockCompletedEventArgs e)
- {
- if (e.Direction == FillDirection.Down
- || e.Direction == FillDirection.Up)
- {
- for (int i = e.RowBegin + 1; i < e.RowBegin + 1 + e.NumberToCopy; i++)
- {
- this.fpSpread1.ActiveSheet.Cells[i, e.ColumnBegin].Value = Convert.ToInt64(this.fpSpread1.ActiveSheet.Cells[e.RowBegin, e.ColumnBegin].Value) + i;
- }
- }
- }
复制代码
Demo如下:
|