Dim sty As CellStyle
With Me.C1FlexGrid1
.Cols.Count = 100
.Rows.Count = 10000
For r As Integer = 1 To 9999
For c As Integer = 1 To 99
sty = .GetCellRange(r, c).StyleNew
sty.ForeColor = Color.Black
sty.BackColor = Color.LightCyan
Next
Next
End With
测试代码如上,就是对每个单元格调用StyleNew属性,然后对取得的该Style设置颜色。
原因应该是每单元格都产生一个CellStyle对象,导致内存占用过量
|