private void btnPrint_Click(object sender, EventArgs e) { if (printDialog1.ShowDialog(this) == DialogResult.OK) { printDialog1.Document = WarrantPrintDocument; WarrantPrintDocument.PrinterSettings = printDialog1.PrinterSettings; WarrantPrintDocument.Print(); } }
private void btnPrint_Click(object sender, EventArgs e) { if (gvIndividual.Rows.Count > 0) { int BXDId; MRS.Model.BXD bxd = new MRS.Model.BXD(); BXDId = (int)gvIndividual.SelectedRows[0].Cells["BXDId"].Value; bxd = bllBXD.GetBXD_By_BXDId(BXDId); WarrantPrintDocument.DocumentName = "报销凭证 " + bxd.Name + " 记录单号:" + bxd.BXDId.ToString(); WarrantPrintDocument.Print(); } }