//6:打印对话框,没有MyPageSetupDialog.Document之类的对象,不能打开 private void PrintLabel_Click(object sender, System.EventArgs e) { MyPrintDialog.Document = MyPrintDocument; if (MyPrintDialog.ShowDialog() == DialogResult.OK) { ResultLabel.Text = "你选择的打印机是:" + MyPrintDialog.PrinterSettings.PrinterName; } }
private void printToolStripMenuItem_Click(object sender, EventArgs e) { var printDoc = new PrintDocument(); printDoc.PrintPage += printDoc_PrintPage; if (MyPrintDialog.ShowDialog() == DialogResult.OK) { printDoc.Print(); } }