-2

我正在尝试使用 Flow Document 打印一些段落和图像,如下面的代码所示

Paragraph invoiceID = new Paragraph(new Run("Invoice No : "+ txtInvoiceID.Text));
Paragraph qty001 = new Paragraph(new Run("Quantity : " + qtyText.Text));
Paragraph date001 = new Paragraph(new Run("Date : " +txtInvoiceDate.Text));

Section sec = new Section();
sec.Blocks.Add(invoiceID);
sec.Blocks.Add(qty001);
sec.Blocks.Add(date001);

FlowDocument fd = new FlowDocument();
PrintDialog pd = new PrintDialog();

fd.PageHeight = pd.PrintableAreaHeight;
fd.PageWidth = pd.PrintableAreaWidth;
fd.PagePadding = new Thickness(50);
fd.ColumnWidth = pd.PrintableAreaWidth;
fd.Blocks.Add(sec);
fd.Blocks.Add(new BlockUIContainer(barCodeImage));

IDocumentPaginatorSource dps = fd;
pd.PrintDocument(dps.DocumentPaginator,"Desciption");

我知道图像已被进程锁定,但我如何才能解锁此图像?

请提供任何帮助

谢谢

贾扎布

4

1 回答 1

-1

在 WPF 中,每个控件只能有一个父级,因为您已经在 xaml 中定义了 barCodeImage,它是某个容器的子级。因此您可以将其从容器中删除或克隆图像

于 2013-05-07T15:32:35.240 回答