private void Form1_Load(object sender, EventArgs e)
{
MyCellType ctp = new MyCellType();
fpSpread1.ActiveSheet.Columns[0].CellType = ctp;
fpSpread1.ActiveSheet.Cells[0, 0].Value = 3;
fpSpread1.ActiveSheet.Cells[1, 0].Value = 2;
fpSpread1.ActiveSheet.Cells[2, 0].Value = 5;
}
}
public class MyCellType : FarPoint.Win.Spread.CellType.GeneralCellType
{
public override void PaintCell(Graphics g, Rectangle r, FarPoint.Win.Spread.Appearance appearance, object value, bool isSelected, bool isLocked, float zoomFactor)
{
if (value != null)
{
value = string.Format("第{0}名", value.ToString());
}
base.PaintCell(g, r, appearance, value, isSelected, isLocked, zoomFactor);
}
就是如果 value = string.Format("第{0}名", value.ToString());
里的第{0}名 是别的内容 并且长度很长,需要换行 我应该怎么操作 |