我想禁用此打印对话框:

我应该怎么做才能删除这个对话框?
var dlg = new PrintDialog();
dlg.PageRangeSelection = PageRangeSelection.AllPages;
dlg.UserPageRangeEnabled = false;
var doc = new FlowDocument();
doc.PageWidth = 275;
doc.FontSize = 18;
doc.TextAlignment = TextAlignment.Center;
doc.Blocks.Add(new Paragraph(new Run("nXXXXXXXXXXXX")));
dlg.PrintDocument(((IDocumentPaginatorSource)doc).DocumentPaginator, "Receipt");发布于 2021-02-19 20:07:14
您可以使用PrintDocument class而不是微软的实现PrintDialog.See
try
{
streamToPrint = new StreamReader
("C:\\My Documents\\MyFile.txt");
try
{
printFont = new Font("Arial", 10);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler
(this.pd_PrintPage);
pd.Print();
}
finally
{
streamToPrint.Close();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}https://stackoverflow.com/questions/66276967
复制相似问题