在Windows 7中无法使用ShowDialog方法显示PrintDialog窗口 [英] Cannot display PrintDialog window using ShowDialog method in Windows 7

查看:196
本文介绍了在Windows 7中无法使用ShowDialog方法显示PrintDialog窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码在使用.NET Framework 2.0(System.Windows.Forms.PrintDialog)构建的应用程序中打印客户端数据:

PrintDialog pd = new PrintDialog();
pd.Document = doc;
         
if(pd.ShowDialog()== DialogResult.OK)
{
    doc.Print();
}

应用程序在Windows XP/Vista中运行良好-出现PrintDialog窗口.但是,当我在Windows 7中运行相同的应用程序时,ShowDialog方法不执行任何操作,并且根本不显示窗口.我没有任何错误,程序仅转到下一条指令.

有人知道解决方案吗?

谢谢.


/>

I have following code that prints client data in my application built using .NET Framework 2.0 (System.Windows.Forms.PrintDialog):

PrintDialog pd = new PrintDialog();
pd.Document = doc;
          
if (pd.ShowDialog() == DialogResult.OK)
{
    doc.Print();
}

Application works fine in Windows XP/Vista - the PrintDialog window appears. But when I run the same application in Windows 7 ShowDialog method does nothing, and window isn't displayed at all. I don't get any errors, program just goes to the next instruction.

Does anyone know the solution?

Thanks.


推荐答案

请尝试:

PrintDialog pd =新的PrintDialog();
pd.Document = doc;
pd.UseEXDialog = true;
如果(pd.ShowDialog()== DialogResult.OK)
{
    doc.Print();
}

PrintDialog pd = new PrintDialog();
pd.Document = doc;
pd.UseEXDialog = true;
if (pd.ShowDialog() == DialogResult.OK)
{
    doc.Print();
}


这篇关于在Windows 7中无法使用ShowDialog方法显示PrintDialog窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆