#250 – 在FlowDocument中使用Section (Including a Section Block in a FlowDocument)

2016-09-08 19:58:53来源:CSDN作者:Libby1984人点击

Section 可以理解为是一类可以被FlowDocument 包含的一块区域。Section 可以作为其他文字内容的容器。你可以在Section 上设置各种属性并使这些属性应用到Section 中包含的其他文字块中。

下面是一个简短的例子:

<FlowDocument FontFamily="Cambria" FontSize="14">    <Paragraph>Act I - George and Martha return from a faculty party, but Martha soon informs George that she has invited over guests.</Paragraph>    <Paragraph>Act II - The wives rejoin the men and Martha begins to describe her husband's only novel.</Paragraph>    <Section Background="LightGreen" Margin="10" FontFamily="Arial" FontSize="12" FontStyle="Italic">        <Paragraph>Novel is embarrassingly autobiographical.</Paragraph>        <Paragraph>George speaks of Martha's hysterical pregnancy.</Paragraph>    </Section></FlowDocument>

效果如下:

上面的例子中FlowDocument 中包含了一个Section ,而Section 中有两个段落。在Section 中设置了背景色和字体等属性,这些属性会被应用到它所包含的段落中。

原文地址:https://wpf.2000things.com/2011/03/19/250-including-a-section-block-in-a-flowdocument/



最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台