private void btnImprimir_Click(object sender, EventArgs e) { printPreviewDialog1.Document = printDocument1; // Marco ((Form)printPreviewDialog1).WindowState = FormWindowState.Maximized; printPreviewDialog1.ShowDialog(); // Marco printDialog1.Document = printDocument1; DialogResult result = printDialog1.ShowDialog(); if (result == DialogResult.OK) { string nomeArquivo = "Atestado_" + oPaciente.Nome + "_" + DateTime.Now.ToShortDateString() + "_" + DateTime.Now.ToShortTimeString(); // Marco nomeArquivo = nomeArquivo.Replace(":", "_"); // Marco nomeArquivo = nomeArquivo.Replace("/", "-"); // Marco printDocument1.DocumentName = nomeArquivo; // Marco printDocument1.Print(); } oPaciente = null; this.Close(); }
private void btnCancelar_Click(object sender, EventArgs e) { oPaciente = null; this.Close(); }
public ImprimirAtestado(OdontoADMDll.BLL.Paciente p) { InitializeComponent(); carregarBoxes(); oPaciente = p; }