public double Render(object row, IRenderEngine engine, double XOffset, double YOffset, Style DefaultStyle, Dictionary <string, double> aggregatedValues) { Image image; if (!string.IsNullOrEmpty(ImageFileName)) { image = Image.FromFile(ImageFileName); } else if (!string.IsNullOrEmpty(ImageFileNameInRow)) { object fileName = row.GetType().GetProperty(ImageFileNameInRow).GetValue(row); if (fileName == null) { return(0); } image = Image.FromFile(fileName.ToString()); } else if (!string.IsNullOrEmpty(ImageArrayInRow)) { object imageArray = row.GetType().GetProperty(ImageArrayInRow).GetValue(row); if (imageArray == null) { return(0); } image = Image.FromStream(new MemoryStream((byte[])imageArray)); } else { return(0); //no image provided } double width = 0; // XRight-XLeft; double height = 0; // YTop-YBottom; if (XRight == 0 && YBottom == 0) { width = image.Width; height = image.Height; } else if (XRight == 0) { height = YBottom - YTop; width = image.Width * (height) / image.Height; } else { width = XRight - XLeft; height = image.Height * (width) / image.Width; } engine.DrawImage(image, XLeft + XOffset, YTop + YOffset, width, height); return(0); }