C# Winform PrintDialog 弹出页面

标签 c# winforms printdialog

在 C# Winform 中,我使用 PrintDialog 将图像发送到打印机...使用此代码:

       private void PrintSnippedImage()
    {
        PrintDocument pDoc = new PrintDocument();
        pDoc.PrintPage += PrintPage;

        PrintDialog pDialog = new PrintDialog();
        pDialog.ShowHelp = true;
        pDialog.AllowSelection = false;
        pDialog.AllowSomePages = false;
        pDialog.Document = pDoc;
        if (pDialog.ShowDialog() == DialogResult.OK)
        {
            pDoc.Print();
        };
    }

    private void PrintPage(object o, PrintPageEventArgs e)
    {
        System.Drawing.Image img = Glob.SnippedImage;
        Point loc = new Point(10, 10);
        e.Graphics.DrawImage(img, loc);
    }

我收到一个弹出窗口,显示“正在打印...文档的第 1 页”,并带有取消按钮。 它出现在我的一台显示器上看似随机的位置。

有没有办法禁止这个弹出窗口,或者至少强制它出现在监视器上调用它的应用程序的一般位置?

看起来像这样:

popup window

最佳答案

这应该是将 PrintController 实现从 PrintControllerWithStatusDialog(默认)交换到 StandardPrintController 的情况。参见 https://learn.microsoft.com/en-us/dotnet/api/system.drawing.printing.printdocument.printcontroller?view=dotnet-plat-ext-6.0#system-drawing-printing-printdocument-printcontroller

关于C# Winform PrintDialog 弹出页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71024671/

相关文章:

c# - winform窗口太大

c# - 使用自定义 UserControl 作为 DataGridView 中的列

java - 将 PrinterJob 对象调整为 BufferedImage 的特定打印格式

c# - 如何更改 win32 窗口上的文本?

c# - 后退键提示,确认退出

c# 枚举函数参数

c# - 如何为 XDocument 指定 xmlns?

C# if else 快捷方式

C# .net Windows Forms Listview 在细节 View 中带有图像

c# - 使用 WebBrowser 显示对话框