无法从'system.drawing.image'转换为'string' [英] Cannot convert from 'system.drawing.image' to 'string'

查看:92
本文介绍了无法从'system.drawing.image'转换为'string'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I want to pass PictureBox to rdlc report, but I get this error

[cannot convert from 'System.Drawing.Image' to 'string'][1]


         private void ReportPrintDes_Load(object sender, EventArgs e)
        {
            pictureBox1.Image = picQr;
            pictureBox2.Image = picQr2;


            reportViewer1.LocalReport.EnableExternalImages = true;
            ReportParameter img = new ReportParameter("img", (pictureBox1));
             this.reportViewer1.RefreshReport();
          



        }


Is there any way to change PictureBox(image) to string, or another way to pass PictureBox to rdlc report?


  [1]: https://i.stack.imgur.com/XMKOe.png





我尝试了什么:



我试图获取图像路径并将其发送到rdlc报告,但我做了不知道如何获取图像路径



What I have tried:

I tried to get the image path and send it to the rdlc report, but I did not know how to get image path

推荐答案

请参见此处示例:如何在RDLC报告中添加外部图像(C#) [ ^ ]

您可以像这样首先保存图像:

See example here: How to add an external image in RDLC Report (C#)[^]
You can save the image first like this:
pictureBox1.Image.Save(@"C:\Temp\Mypic.jpg",ImageFormat.Jpeg);


这篇关于无法从'system.drawing.image'转换为'string'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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