如果需要设置选中区域单元格的属性,除了for循环以外,也可以使用Cells来设置:
- CellRange cr = fpSpread1.ActiveSheet.GetSelection(0);
- fpSpread1.ActiveSheet.Cells[cr.Row, cr.Column, cr.Row + cr.RowCount, cr.Column + cr.ColumnCount].ForeColor = Color.Red;
复制代码
此外,如果你需要在for中设置Spread的相关属性,建议你将这些代码放到SuspendLayout和ResumeLayout方法中间:
- fpSpread1.SuspendLayout();
- CellRange cr = fpSpread1.ActiveSheet.GetSelection(0);
- fpSpread1.ActiveSheet.Cells[cr.Row, cr.Column, cr.Row + cr.RowCount, cr.Column + cr.ColumnCount].ForeColor = Color.Red;
- fpSpread1.ResumeLayout(true);
复制代码
可以参考以下帖子:
http://gcdn.grapecity.com/showtopic-2244.html
http://gcdn.grapecity.com/showto ... 2&typeid=35 |