김혜주 님, 안녕하세요.
메시어스입니다.
셀 타입은 한 가지 종류만 적용 가능합니다.
샘플을 수정하여 전달 드리니, 아래 샘플 코드를 참고 부탁드립니다.
private void Form1_Load(object sender, EventArgs e)
{
fpSpread1.AllowUserFormulas = true;
MyCurrencyCellType myCurrencyCellType = new MyCurrencyCellType();
fpSpread1.ActiveSheet.Cells[0, 0].CellType = myCurrencyCellType;
}
public class MyCurrencyCellType : FarPoint.Win.Spread.CellType.CurrencyCellType
{
private bool IsZero(object obj)
{
return obj is 0.0; //double 타입에 대해서만 동작합니다.int, long과 같은 다른 유형과 작동하려면 수정해야 합니다.
}
public override string Format(object obj)
{
return IsZero(obj) ? "" : base.Format(obj);
}
public override void PaintCell(System.Drawing.Graphics g, System.Drawing.Rectangle r, FarPoint.Win.Spread.Appearance appearance, object value, bool isSelected, bool isLocked, float zoomFactor)
{
base.PaintCell(g, r, appearance, IsZero(value) ? "" : value, isSelected, isLocked, zoomFactor);
}
}
감사합니다.