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;
}
}
}
FarPoint.Win.Spread.InputMap inputmap1;
inputmap1 = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.
inputmap1 = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
inputmap1.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRowWrap);
FarPoint.Win.Spread.InputMap inputmap2;
inputmap2 = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
inputmap2.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRowWrap);
} |