回复 15楼wangleiecho的帖子
wangleiecho 你好
我修改了ImageText的代码,请参考:
- public class ImageText : FarPoint.Win.Spread.CellType.ImageCellType
- {
- private Picture picture;
- public string strValue = string.Empty;//文字
- public ImageText()
- {
- picture = new Picture();
- }
- public override void PaintCell(Graphics g, Rectangle r, FarPoint.Win.Spread.Appearance appearance, object value, bool isSelected, bool isLocked, float zoomFactor)
- {
- if (value != null)
- {
- Image image = value as Image;
- SolidBrush brush = new SolidBrush(Color.White);
- GraphicsState gstate = g.Save();
- g.IntersectClip(r);
- g.FillRectangle(brush, r);
- brush.Dispose();
- if (image != null)
- {
- Rectangle rectangle = new Rectangle(new Point(r.X, r.Y), new Size(200, 200));
- if (rectangle == Rectangle.Empty)
- {
- g.Restore(gstate);
- return;
- }
- picture.Image = image;
- picture.Paint(g, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
- g.DrawString(strValue, appearance.Font, new SolidBrush(Color.Black), new PointF(r.X, r.Y + 200));
- }
- g.Restore(gstate);
- }
- else
- {
- base.PaintCell(g, r, appearance, value, isSelected, isLocked, zoomFactor);
- }
- }
- }
复制代码 |