闲着无聊,把以前做过的一些代码整理一下
Code
LocalReport localReport = new LocalReport();
//加载报表模板文件
localReport.ReportEmbeddedResource = "Report1.rdlc";
//设置参数
ReportParameter pCallerName = new ReportParameter( "Name" , txtName.Text );
//产生报表图片
string mimeType;
string encoding;
string fileNameExtension;
string[] streams;
Warning[] warnings;
byte[] reportDocument = localReport.Render( "Image" , null , out mimeType , out encoding , out fileNameExtension , out streams , out warnings );
Image reportImage = ImageUtil.FromBytes( reportDocument );
//绘制原始报表
Graphics gra = this.label6.CreateGraphics();
gra.DrawImage( reportImage , 1 , 1 );
//绘制身份证照片
if ( _idCardPhoto != null )
gra.DrawImage( ImageUtil.FromBytes( _idCardPhoto ) , 40 , 190 , 240 , 280 );
//绘制条形码
gra.DrawString( "*" + _codeNum + "*" , new Font( new FontFamily( "C39HrP36DmTt" ) , 75f ) , Brushes.Black , 35 , 490 );
LocalReport localReport = new LocalReport();
//加载报表模板文件
localReport.ReportEmbeddedResource = "Report1.rdlc";
//设置参数
ReportParameter pCallerName = new ReportParameter( "Name" , txtName.Text );
//产生报表图片
string mimeType;
string encoding;
string fileNameExtension;
string[] streams;
Warning[] warnings;
byte[] reportDocument = localReport.Render( "Image" , null , out mimeType , out encoding , out fileNameExtension , out streams , out warnings );
Image reportImage = ImageUtil.FromBytes( reportDocument );
//绘制原始报表
Graphics gra = this.label6.CreateGraphics();
gra.DrawImage( reportImage , 1 , 1 );
//绘制身份证照片
if ( _idCardPhoto != null )
gra.DrawImage( ImageUtil.FromBytes( _idCardPhoto ) , 40 , 190 , 240 , 280 );
//绘制条形码
gra.DrawString( "*" + _codeNum + "*" , new Font( new FontFamily( "C39HrP36DmTt" ) , 75f ) , Brushes.Black , 35 , 490 );