【问题标题】:Application print function crashing in XPXP中的应用程序打印功能崩溃
【发布时间】:2013-03-19 10:58:38
【问题描述】:

我为家族企业制作了一个 WPF 应用程序,该应用程序之前运行良好。上个月他们格式化了 PC,这次安装了 XP。虽然该应用程序仍然可以工作,但一旦执行发票或任何其他打印操作,它就会崩溃。

以下是代码。让我知道此问题的任何解决方法,否则我需要重新安装 Windows 7。

private void printButton_Click(object sender, RoutedEventArgs e)
{
    string path = Directory.GetCurrentDirectory();
    PrintInvoice pi = new PrintInvoice();
    pi.DataContext = this.DataContext;
    PrintDialog printDlg = new System.Windows.Controls.PrintDialog();
    if (printDlg.ShowDialog() == true)
    {
        pi.Measure(new Size(printDlg.PrintableAreaWidth,
        printDlg.PrintableAreaHeight));
        pi.Arrange(new Rect(new Size(printDlg.PrintableAreaWidth, printDlg.PrintableAreaHeight)));
        pi.Margin = new Thickness(40);
        pi.UpdateLayout();

        //now print the visual to printer to fit on the one page.
        printDlg.PrintVisual(pi, "First Fit to Page WPF Print");
    }
    Directory.SetCurrentDirectory(path);
}

【问题讨论】:

    标签: wpf printing


    【解决方案1】:

    当我们的一些客户降级到 Windows XP 时,我们也遇到了类似的问题。在我们的例子中,来自系统事件日志的异常消息是

    框架版本:v4.0.30319

    描述:应用程序通过 System.Environment.FailFast(string message) 请求进程终止。

    消息:不可恢复的系统错误

    解决方案是在目标机器上安装Microsoft XML Paper Specification Essentials Pack

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-06-23
      • 1970-01-01
      • 2021-11-07
      • 1970-01-01
      • 1970-01-01
      • 2012-10-10
      • 2016-10-28
      相关资源
      最近更新 更多