新建一个celltype 重写paint 方法
- public class MyCellType : FarPoint.Win.Spread.CellType.TextCellType
- {
- public override void PaintCell(Graphics g, Rectangle r, FarPoint.Win.Spread.Appearance appearance, object value, bool isSelected, bool isLocked, float zoomFactor)
- {
- base.PaintCell(g, r, appearance, value, isSelected, isLocked, zoomFactor);
- // Create graphics path object and add ellipse.
- System.Drawing.Drawing2D.GraphicsPath graphPath = new System.Drawing.Drawing2D.GraphicsPath();
- graphPath.AddEllipse(r.X + 5, r.Y + 5, r.Width - 10, r.Height - 10);
- // Create pen.
- Pen blackPen = new Pen(Color.Black, 3);
- // Draw graphics path to screen.
- g.DrawPath(blackPen, graphPath);
- }
- }
复制代码
使用心得CellType
- var textCell = new MyCellType();
- fpSpread1.ActiveSheet.Cells[0, 0].CellType = textCell;
复制代码 |