主题:[讨论]关于打印对话框的代码
red047
[专家分:90] 发布于 2006-07-29 19:46:00
我目前正在写一个程序,在打印对话框这下不去了,请高手指教指教!谢谢
回复列表 (共2个回复)
沙发
telancs [专家分:680] 发布于 2006-07-29 22:02:00
打印对话框(PrintDialog)
1、打印对话框(PrintDialog)有以下属性:
AllowPrintToFile
禁止或使用"打印到文件"复选框
AllowSelection
禁止或使用"选定内容"单选框
AllowSomePages
禁止或使用"页"单选按钮
Document
从中获取打印机设置的PrintDocument
PrintToFile
打印到文件"复选框是否选中
ShowHelp
控制是否显示"帮助"按钮
ShowNetWork
控制是否显示"网络"按钮
2、用如下代码来实现:
private void printDialogBTN_Click(object sender, System.EventArgs e)
{
PrintDialog printDialog=new PrintDialog();
printDialog.Document=printDocument;
if(printDialog.ShowDialog()!=DialogResult.Cancel)
{
try
{
printDocument.Print();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
板凳
red047 [专家分:90] 发布于 2006-07-31 10:25:00
行了,谢谢....
我来回复