WPF之文档与RichTextBox

1,文档分类:

        文档分为流文档(FlowDocument,布局可变)与固定文档(xps,pdf等布局不可变)。

        注明:流内容元素继承自ContentElement和FrameworkContenteElement而非常用的UIElement和FrameworkElement

2,文档容器:

流文档(FlowDocument)容器(只读,共三个)。

  •  FlowDocumentScrollViews:不能分页也不能分列显示。

        示例:

 <FlowDocumentScrollViewer IsSelectionEnabled="False">
            <FlowDocument Background="SkyBlue">
               ....
            </FlowDocument>
        </FlowDocumentScrollViewer>

        效果:

  • FlowDocumentPageViews:可进行分页和分列显示。

        示例

 <FlowDocumentPageViewer >
            <FlowDocument ColumnWidth="200" IsColumnWidthFlexible="True" ColumnRuleBrush="SkyBlue" ColumnRuleWidth="2" ColumnGap="30" >
                <Paragraph>
                      The sixth of August was my mothers birthday.My father and I wanted to give her surprising birthday presents.On their mothersbirthday,I know some of my classmates are going to help their mothers with housework;others are going to the shop and buy some flowers for their mothers.
                </Paragraph>
                <Paragraph>
                      In the morning,my father and I went shopping and bought a very nice cake.Then we went to the market and bought some food.When we got home,my father cooked some nice food in the kitchen.I went to my room to make a birthday card.I wanted to say to my mother that I loved her very much.Then I wrote in the card,"I love you,my dear mother!"I put it on her pillow,then we cleaned the room.We felt very tired,but we were very happy.
                </Paragraph>
                <Paragraph>
                      My mother got home.We said,"Happy Birthday!"My mother smiled.We had our supper together.My mother said,"Thank you,my daughter!"
                </Paragraph>
                <Paragraph>
                     How happy we were!
                </Paragraph>
                <Paragraph>
                   
                        <Image Source="Img/1.jpg"></Image>
                  
                </Paragraph>
            </FlowDocument>
        </FlowDocumentPageViewer>

         效果:

  •  FlowDocumentReader:可进行分页和分列显示,同时增加了查找功能,是三个中开销最大的容器。

固定文档容器:

        显示格式内容已固定的文档(例如xps文档),一般用于文档预览呈现。

        注明:XPS文件实际上是包含压缩文件库的ZIP文件,包含字体,图像以及用于每一页的文本内容,可将XPS的扩展名修改为.zip并打开它

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值