求助关于报表打印前指定打印机的问题!
用下面的方法显示报表预览窗口,上面有自带的"打印"按钮,点击后则自动调用默认的打印机打印当前面页内容,但是我希望点"打印"时调出系统打印对话框,供用户选择用哪一台打印机和打印哪一页的内容!也就是说要控制打印预览控件的"打印"按钮,具体代码要怎么写,还有写在哪里?我的代码如下:
//打印预览
try
{
PrintDocument pd = new PrintDocument();
pd.DefaultPageSettings.PaperSize = new PaperSize("A4", 827, 1169);
//pd.DefaultPageSettings.Landscape = true;
pd.DocumentName = "报表系统";
pd.PrintPage+=new PrintPageEventHandler(pd_PrintPage);
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = pd;
ppd.SetBounds(0, 0,Screen.PrimaryScreen.WorkingArea.Width,Screen.PrimaryScreen.WorkingArea.Height);
PrintPreviewControl ppc = new PrintPreviewControl();
ppc.Document = pd;
ppd.ShowDialog();
}
catch (Exception Error)
{
MessageBox.Show("报表预览时出错!" + Error.ToString(), "系统提示");
}
//
private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
//打印详细页......
}
[[it] 本帖最后由 C心情 于 2008-11-2 15:52 编辑 [/it]]