在运行时将图像添加到 Crystal Report [英] Add Image To Crystal Report At Runtime

查看:21
本文介绍了在运行时将图像添加到 Crystal Report的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在运行时将图像添加到水晶报表.

I would like to add an image to a crystal report at runtime.

我目前正在使用第二个数据表执行此操作,该数据表仅包含一个字节字段,然后是报表上的一个 blob 字段.然而,这感觉像是一种黑客行为,如果第一个主表中没有数据,那么由于某种原因,图像不会显示.

I am currently doing this using a second data table containing only a byte field and then a blob field on the report. However this feels like a hack and if there is no data in the first primary table then for some reason the image does not show.

是否可以使用代码或其他方法添加图像?

Is it possible to add an image with code or another method?

我正在为 Visual Studio 2010 使用 Crystal Reports.Winforms 项目.C# 或 VB.

I'm using crystal reports for visual studio 2010. Winforms project. Either C# or VB.

推荐答案

如果要将徽标存储在磁盘而不是数据库中:

If you want to store the logo on disk instead of in the database:

  1. 在 Designer 中,插入占位符图片.
  2. 右键单击占位符图像,然后单击设置图形格式.在图片标签的图片位置旁边,点击公式按钮.在此处输入路径,或提供提供路径的公式.
  1. In Designer, insert a placeholder image.
  2. Right-click the placeholder image, and click Format Graphic. On the Picture tab, next to Graphic Location, click the formula button. Enter the path there, or provide a formula which provides it.

在运行时,Crystal 将替换文件中的图像.

At runtime, Crystal will substitute the image from the file.

如果需要,您可以在公式中使用参数字段.这样您就可以在运行时以编程方式提供路径.

If you want, you can use a parameter field in your formula. That way you can provide the path programmatically at runtime.

这篇关于在运行时将图像添加到 Crystal Report的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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