回复 5楼liuyinlong的帖子
不知道你的代码是如何实现的,请参考:
- private void fpSpread1_SelectionChanged(object sender, FarPoint.Win.Spread.SelectionChangedEventArgs e)
- {
- FarPoint.Win.Spread.Model.CellRange[] cr = this.fpSpread1.Sheets[0].GetSelections();
- int sum = 0;
- int cellValue = 0;
- for (int i = 0; i < cr.Length; i++)
- {
- for (int j = 0; j < cr[i].RowCount; j++)
- {
- for (int k = 0; k < cr[i].ColumnCount; k++)
- {
- if (this.fpSpread1.Sheets[0].Cells[cr[i].Row + j, cr[i].Column + k].Value != null)
- {
- cellValue = Convert.ToInt32(this.fpSpread1.Sheets[0].Cells[cr[i].Row + j, cr[i].Column + k].Text);
- sum += cellValue;
- this.toolStripStatusLabel1.Text = sum.ToString();
- }
- }
- }
- }
- }
复制代码 |