public void Print(string name) { SourceCodePrintDocument printDocument = getPrintDocument(name); PrintDialog print = new PrintDialog() { Document = printDocument }; if (print.ShowDialog() == DialogResult.OK) { printDocument.Print(); } }
private void mnuFile_Print_Click(object sender, EventArgs e) { if (ActiveMdiChild == null) { return; } var ef = (EditForm)ActiveMdiChild; var pd = new SourceCodePrintDocument(ef.sDoc); dlgPrint.Document = pd; if (dlgPrint.ShowDialog(this) == DialogResult.OK) { pd.Print(); } }