soo*_*ise 1 c# printing printdialog
如果我运行此代码,并在PrintDialog上按取消,它仍会打印.如何判断使用是否取消?
PrintDocument document = new PrintDocument();
PrintDialog dialog = new PrintDialog();
dialog.ShowDialog();
document.PrinterSettings = p.PrinterSettings;
document.Print();
Run Code Online (Sandbox Code Playgroud)
附录
WebBrowser w = new WebBrowser();
w.ShowPrintDialog(); //.ShowPrintDialog returns a void, how can I deal with this?
Run Code Online (Sandbox Code Playgroud)
您可以检查ShowDialog方法的结果:
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
//Print
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3277 次 |
最近记录: |