1
我做了一個WPF應用程序的家庭企業,工作得很好。上個月,他們對PC進行了格式化,並且這次安裝了XP。雖然應用程序仍然有效,但一旦發票或任何其他打印操作就會崩潰。WPF應用程序打印功能在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);
}
感謝隊友....問題解決.... – 2013-03-19 12:52:50