如何在wpf c#中从数据库字节数组中显示rdlc中的图像

时间:2017-05-31 05:24:27

标签: rdlc

SignatureImage =(byte[])dr["SignImage"];
SignatureImage1 = Encoding.Default.GetString(SignatureImage);

bmp = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(bmp);
g.Clear(System.Drawing.Color.White);
char div = '^';
string[] signature_divide = SignatureImage1.Split(div);
string x;
string y;
string x_y;
int mt30Flag = 0;
for (int i = 0; i < signature_divide.Length - 1; i++) {
    try
    {

        x_y = signature_divide[i];
        int pos = signature_divide[i].IndexOf(",");
        x = x_y.Substring(0, pos);

        y = x_y.Substring(pos + 1);

        if (Int32.Parse(y) == 65535)
        {
        mt30Flag = 1;
        }


        if (Int32.Parse(x) <= 480 && Int32.Parse(y) <= 320)
        {
        bmp.SetPixel(Int32.Parse(x), Int32.Parse(y), System.Drawing.Color.Black);
        }
    }
    catch (System.Exception ex)
    {

    }

} 
objset.tbl_Image.Merge(tempimage);                      

**未发现错误且没有任何异常**但图像未在rdlc中显示。

在上面的代码我已经将我的字节类型数据转换为位图并传递给rdlc数据源。 请帮我从数据库字节数组中显示rdlc中的图像。 ASAP

1 个答案:

答案 0 :(得分:0)

您需要将Image的属性Datasource设置为Database。并使用byte []字段。

screenshot