FastReport编程方式给Picture控件赋值

    public Image BytesToImage(Byte[] buffer)
    {
      var ms = new MemoryStream(buffer, 0, buffer.Length);
        
      return Image.FromStream(ms);
    }
    private void Text26_BeforePrint(object sender, EventArgs e)
    {                 
      DataSourceBase ds = Report.GetDataSource("subDataTable");

      ds.Init();      
      while (ds.HasMoreRows)
      {
        // get the data column value from the current row
        string imgName = (string)Report.GetColumnValue("subDataTable.IMGNAME");
                      
        if(imgName=="img2")
        {          
           Picture2.Image=  BytesToImage(Convert.FromBase64String(Report.GetColumnValue("subDataTable.检测图片").ToString())) ;
        }  
        // do something with it...
        s+=imgName+",";  
        // go next data row
        ds.Next();
      }                
    }

 

posted @ 2018-12-14 15:25  麻将我会  阅读(644)  评论(1编辑  收藏