FixedDocument を自動的に改ページするにはどうすればよいですか? 整形済みの Panel を DocViewer に配置するために使用できる次のコードがあります。この問題は、パネルが 1 ページを超えると発生します。今は、クリップするだけです。基本的に、ユーザーが見ているものを印刷するためのかなり一般的な方法を作成したいと考えています。私のアプローチは合理的ですか?
public void CreateReport(Panel details)
{
FixedDocument fixedDoc = new FixedDocument();
PageContent pageContent = new PageContent();
FixedPage fixedPage = new FixedPage();
fixedPage.DataContext = this.DataContext;
fixedPage.Margin = new Thickness(10);
fixedPage.Children.Add(details);
((System.Windows.Markup.IAddChild)pageContent).AddChild(fixedPage);
fixedDoc.Pages.Add(pageContent);
// This makes the array of controls invisibile, then climbs the details structure
// and makes the controls within details appropriate for the DocumentViewwer (i.e. TextBoxes are
// non-editable, no borders, no scroll bars, etc).
prePrintPrepare(details, fixedPage, new FrameworkElement[] { controlToMakeInvisible });
_dv = new DocViewer();
_dv.documentViewer1.Document = fixedDoc;
_dv.Show();
}