gpt4 book ai didi

c# - 从图像文件夹中在 Crystal 报表页面中插入动态图像

转载 作者:太空狗 更新时间:2023-10-29 23:47:15 25 4
gpt4 key购买 nike

有没有办法从图像文件夹中将图像动态插入 Crystal Reports 页面?

确切的要求是在顶部显示公司的 Logo 每个 Crystal 报表页面以及它们何时更改,即当您有新标志,您只需更改图像文件夹中的图像(.jpg)和所有报告中的相应图像都应该改变。

我如何在 C# 中实现这一点?

最佳答案

I'm posting the answer i got, hope this would be helpful for others.

private void getImage()
{
FileStream fs;
fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + "img\\cube.png", FileMode.Open);
BinaryReader BinRed = new BinaryReader(fs);
try
{
CreateTable();
DataRow dr = this.DsImages.Tables["images"].NewRow();
dr["image"] = BinRed.ReadBytes((int)BinRed.BaseStream.Length);
this.DsImages.Tables["images"].Rows.Add(dr);

//FilStr.Close();
BinRed.Close();

DynamicImageExample DyImg = new DynamicImageExample();
DyImg.SetDataSource(this.DsImages);
this.crystalReportViewer1.ReportSource = DyImg;
}
catch (Exception er)
{
MessageBox.Show(er.Message, "Error");
}
}

关于c# - 从图像文件夹中在 Crystal 报表页面中插入动态图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12155317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com