4,816
社区成员
发帖
与我相关
我的任务
分享
private void btn裁片细码单_Click(object sender, EventArgs e)
{
//打印前,加载等待动画
Form1 afrm = new Form1();//我这里用一个Form窗体,做的等待动画
afrm.Show();
afrm.Refresh();
//水晶报表打印
ReportDocument aReportDocument = new ReportDocument();
aReportDocument.Load(@"E:\CrystalReportsApplication1\裁片细码单.rpt");
foreach (Table aTable in aReportDocument.Database.Tables)
{
aTable.LogOnInfo.ConnectionInfo.ServerName = clsIni.ServerName;//控制面板-数据源
aTable.LogOnInfo.ConnectionInfo.DatabaseName = clsIni.DatabaseName;//数据库名称
aTable.LogOnInfo.ConnectionInfo.UserID = clsIni.UserID;//用户名
aTable.LogOnInfo.ConnectionInfo.Password = clsIni.Password;//密码
aTable.ApplyLogOnInfo(aTable.LogOnInfo);
}
View.SelectionFormula = "{表名.ID} = 'A001' ";
View.ReportSource = aReportDocument;
//View.Zoom(100);
//打印完后,释放等待动画
afrm.Dispose();
}
while (t != 1)
{
Refresh();
}
public partial class GifForm : Form
{
public GifForm()
{
InitializeComponent();
}
private int t = 0;
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Visible = false;
// pictureBox1.Image = Resources._2;
pictureBox1.Visible = true;
Refresh();
// Refresh();
ThreadPool.QueueUserWorkItem(Print,null);
//Print();
while (t != 1)
{
}
}
private void Print(Object o)
{
for (int i = 0; i < 15000; i++)
{
Console.Write(".");
}
Console.WriteLine("..end..:{0}", System.DateTime.Now.ToString("HH.mm.ss.ffff"));
t = 1;
}
}
PrintJiShuYaoQiu print = new PrintJiShuYaoQiu();
print.Path = PATH;//自己选择的rdlc报表的报表路径
print.GetDataTable = dataSet.Tables[dataMember];
print.GetDataMember = dataMember;
print.ShowDialog();
private void PrintJiShuYaoQiu_Load(object sender, EventArgs e)
{
this.reportViewerPrint.Reset();
this.reportViewerPrint.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;
this.reportViewerPrint.LocalReport.ReportPath = PATH;
this.reportViewerPrint.LocalReport.DataSources.Add(new ReportDataSource(dataMember, dataTable));//这里的dataTable,dataMember,PATH都是刚刚那个传过来的
this.reportViewerPrint.RefreshReport();
}