المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Passing byte[] to Report



C# Programming
05-06-2009, 10:40 PM
Is it possible to somehow pass an image to a report? I have the byte[] but the ReportParameter only takes strings. So how do I pass the byte (which contains an image) and pass it to the report and display the image in the report?

Currently I'm passing this:


ReportParameter[] parameters = new ReportParameter[6];
parameters[0] = new ReportParameter("Tag", this.Tag);
parameters[1] = new ReportParameter("Completed", dateTimeCompleted.Value.ToLongDateString());
parameters[2] = new ReportParameter("HDModel", txtModel.Text);
parameters[3] = new ReportParameter("HDSerial", txtSerial.Text);
parameters[4] = new ReportParameter("HDSize", txtSize.Text);
parameters[5] = new ReportParameter("Signature", GetSig().ToString());


GetSig() gets the bytes:

byte[] GetSig()
{
MemoryStream ms = new MemoryStream();
Bitmap SaveBMP = new Bitmap(panelSig.Size.Width, panelSig.Size.Height);
panelSig.DrawToBitmap(SaveBMP, new Rectangle(0, 0, panelSig.Size.Width, panelSig.Size.Height));
SaveBMP.Save(ms, ImageFormat.Png);

byte[] sigPic = ms.ToArray();
ms.Close();
ms.Dispose();
SaveBMP.Dispose();

return sigPic;
}



But how do I display that in the reportviewer on the report?