Image 那里设置tag也需要改
- MyCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
- //Paints a cell on the canvas.
- if (value) {
- GC.Spread.Sheets.CellTypes.Base.prototype.paint.apply(this, [ctx, value, x, y, w, h, style, options]);
- var sheet = options.sheet, row = options.row, col = options.col;
- var tag = sheet.getTag(row, col) || {};
- if(tag && tag.img){
- ctx.drawImage(tag.img, x + w - h + 1, y + 1, h - 2, h - 2);
- }
- else{
- var img = new Image();
- img.src = iconImage;
- img.onload = function(){
- tag.img = img;
- sheet.setTag(row, col, tag)
- sheet.repaint();
- }
- }
- }
- };
复制代码 |