如何显示在一个RDLC报表图像 [英] How to show images on an RDLC report

查看:197
本文介绍了如何显示在一个RDLC报表图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个RDLC报告,并希望在表中的一列本报告中显示的图像上。数据源为我的报告是,有一个叫做类System.Drawing.Image对象的图像属性的一类。

I have an RDLC report and would like one of the columns in a table on this report to display images. The datasource for my report is a class that has a property called Image of type System.Drawing.Image.

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

On my report I dragged an image control onto the column and I set the following properties:

MIMEType:  image/png
Source:  Database
Value:  =Fields!Image.Value

当我跑我的报告,我得到一个破碎的形象。

When I run my report, I get a broken image.

我真的AP preciate任何建议!

I'd really appreciate any suggestions!

在此先感谢:O)

推荐答案

我不知道这是不是最好的解决办法,但我得到它的工作。它看起来像问题是使用System.Drawing.Image对象。

I don't know if this is the best solution, but I got it to work. It looks like the problem was in using System.Drawing.Image.

在我的课,我创建了一个名为[]类型字节ImageByte新的属性。我没有做一个二传手的ImageByte,但我做了一个getter,做了以下内容:

In my class, I created a new property called ImageByte of type byte[]. I didn't make a setter for ImageByte, but I made a getter that does the following:

MemoryStream ms = new MemoryStream();
Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
return ms.ToArray();

我更新了我的报告有=字段ImageByte.Value的价值,现在一切似乎是按预期工作:O)

I updated my report to have =Fields!ImageByte.Value for the Value and now everything appears to be working as expected :o)

这篇关于如何显示在一个RDLC报表图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆