如何在RDLC报告上显示图像

Tin*_*oji 9 reportviewer rdlc .net-3.5

我有一个RDLC报告,并希望此报告表格中的一列显示图像.我的报告的数据源是一个具有名为Image of type的属性的类System.Drawing.Image.

在我的报告中,我将图像控件拖到列上,然后设置以下属性:

MIMEType:  image/png
Source:  Database
Value:  =Fields!Image.Value
Run Code Online (Sandbox Code Playgroud)

当我运行我的报告时,我得到一个破碎的图像.

我真的很感激任何建议!

在此先感谢:o)

Tin*_*oji 10

我不知道这是否是最好的解决方案,但我得到了它的工作.看起来问题在于使用System.Drawing.Image.

在我的课堂上,我创建了一个名为ImageByte的新属性byte [].我没有为ImageByte制作一个setter,但我制作了一个执行以下操作的getter:

MemoryStream ms = new MemoryStream();
Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
return ms.ToArray();
Run Code Online (Sandbox Code Playgroud)

我将我的报告更新为= Fields!ImageByte.Value for Value,现在一切看起来都按预期工作:o)