PrintDialog.ShowDialog不能显示打印对话框

在XP环境下,它可以正常显示出打印对话框。但在Windows 7 64位环境下,什么也显示不出来,也没有异常抛出。

将PrintDialog.UseEXDialog属性设置为True,可显示出打印对话框。代码如下:

        private void button2_Click(object sender, EventArgs e)
        {
            // 打印机设置对话框
            PrintDialog print = new PrintDialog();

            print.Document = printDocument1;
            print.AllowCurrentPage = true;
            print.AllowPrintToFile = true;
            print.AllowSelection = true;
            print.AllowSomePages = true;
            print.ShowHelp = true;
            print.UseEXDialog = true;
            if (print.ShowDialog() == DialogResult.OK)
            {
                // 将设置好的打印机 用作 PrinDocument进行打印。
                printDocument1.PrinterSettings = print.PrinterSettings;
            }
        }
原文地址:https://www.cnblogs.com/xubao/p/14010579.html