通过C#窗体在Crystal Report上动态显示图像
问题描述:
大家好,
尊敬的程序员iam将通过Button单击的C#窗体在Crystal报表上显示图像.图像路径应从当前项目中选择.
我已将其与数据库一起显示,但无法从当前项目路径中的图像显示它.
请任何人帮助我.
HY Everybody,
Dear programmers iam going to display an image on crystal report from C# Form on Button Click.The image path should be Selected from the Current Project.
i have display it with database but i cannot display it from the images present in my current project path.
Please any body help me.
答
如果要将数据表或数据集用作水晶报表的数据源,那么它非常容易.
只需将图像读入流中即可.将流添加为数据表中的列.将表设置为数据源.就是这样.
Hi,
If you are using datatable or dataset as datasource for crystal reports, then its very easy.
Just read the images into a stream. add the stream as a column in your data table. set the table as datasource. thats it.
//Just for an information I'm just typing this code
//Correct the syntactical errors
DataTable tbl;
MemoryStream ms;
//your data table filling logic
tbl.Columns.add("ImageColumn",typeof(string));//Fine tune this
ms = //load your image into stream
tbl.rows(0).setitem //to set the image data
//set this tbl as datasource for your report
要显示图像,请查看以下内容:
如何使用Visual Studio 2005在Crystal Reports中动态加载图像 [ Crystal Reports:如何在Crystal Report中显示图像 [ Crystal Reports中的图像 [
To display images, have a look at these:
How to dynamically load images in Crystal Reports using Visual Studio 2005[^]
Crystal Reports: How to Display Images in a Crystal Report[^]
Image in Crystal Reports[^]