【发布时间】:2010-02-23 20:19:33
【问题描述】:
我有以下代码来弹出一个打印机对话框,但无论我选择什么打印机,它总是打印到默认打印机。
如何分配用户选择的打印机? (从对话窗口)
PrintDialog pdlg = new PrintDialog();
// Show the PrintDialog
if (pdlg.ShowDialog() == DialogResult.OK)
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
// Associate PrintDocument object with the PrintDialog
pdlg.Document = pd;
// Print with the new PrinterSettings
pd.Print();
}
【问题讨论】: