for (int i = 0; i < fpSpread1.ActiveSheet.RowCount; i++)
{
for (int j = 0; j < fpSpread1.ActiveSheet.ColumnCount; j++)
{
if (fpSpread1.ActiveSheet.Cells[i, j].Locked.Equals(false))
{
// fpSpread1.ActiveSheet.Cells[i, j].BackColor = System.Drawing.Color.FromArgb(((System.Byte)(198)), ((System.Byte)(226)), ((System.Byte)(255)));
}
else
{
//fpSpread1.ActiveSheet.Cells[i, j].BackColor = this.BackColor;
fpSpread1.ActiveSheet.Cells[i, j].CanFocus = false;
}
if (this.fpSpread1.ActiveSheet.Cells[i, j].Locked.Equals(false) && flag)//聚焦第一个单元格
{
this.fpSpread1.ActiveSheet.SetActiveCell(i, j);
flag = false;
}
}
}
我是想设置lock为false时,就可以聚焦,光标导航时就在可填写的格子内导航,然而设置canfoucs属性时,就触发了,然后就很耗时。 |