flowDocument 内部复选框的 Printg 问题
我想知道这是否是打印流程文档的正确方法:( 但这是一个很奇怪的现象。
我的代码是这样的:
string flowDocString =
" <FlowDocument xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>" +
" <Section>" +
" <Paragraph>" +
" <CheckBox IsChecked='True'>Test</CheckBox>" +
" </Paragraph>" +
" </Section>" +
" </FlowDocument>";
FlowDocument flowDoc = (FlowDocument)XamlReader.Load(new MemoryStream(new UTF8Encoding().GetBytes(flowDocString)));
PrintDialog printDlg = new PrintDialog();
IDocumentPaginatorSource idpSource = flowDoc;
printDlg.PrintDocument(idpSource.DocumentPaginator, "Hello WPF Printing.");
当我使用此代码时,复选框的状态仍未选中。 但是当我像这样修改 flowDocString 时:
string flowDocString =
" <FlowDocument xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>" +
" <Section>" +
" <Paragraph>" +
" <CheckBox IsChecked='True' IsEnabled='False'>Test</CheckBox>" +
" </Paragraph>" +
" </Section>" +
" </FlowDocument>";
如果修改以上结果将按预期显示。 怎么会发生这样的事呢?请告诉我为什么。
I wonder whether this is right way to print flowdocument :(
but this is a very strange phenomenon.
My Code like this:
string flowDocString =
" <FlowDocument xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>" +
" <Section>" +
" <Paragraph>" +
" <CheckBox IsChecked='True'>Test</CheckBox>" +
" </Paragraph>" +
" </Section>" +
" </FlowDocument>";
FlowDocument flowDoc = (FlowDocument)XamlReader.Load(new MemoryStream(new UTF8Encoding().GetBytes(flowDocString)));
PrintDialog printDlg = new PrintDialog();
IDocumentPaginatorSource idpSource = flowDoc;
printDlg.PrintDocument(idpSource.DocumentPaginator, "Hello WPF Printing.");
When I use this code, the checkbox's state is still unchecked.
But when I modify the flowDocString like this:
string flowDocString =
" <FlowDocument xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>" +
" <Section>" +
" <Paragraph>" +
" <CheckBox IsChecked='True' IsEnabled='False'>Test</CheckBox>" +
" </Paragraph>" +
" </Section>" +
" </FlowDocument>";
If you modify the above results will be displayed as intended.
How can this happened? Please tell me why.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论