FlowDocument.Background 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置要用于填充内容区域背景的 Brush。
public:
property System::Windows::Media::Brush ^ Background { System::Windows::Media::Brush ^ get(); void set(System::Windows::Media::Brush ^ value); };
public System.Windows.Media.Brush Background { get; set; }
member this.Background : System.Windows.Media.Brush with get, set
Public Property Background As Brush
属性值
用于填充内容区域背景的画笔,或 null
(不使用背景画笔)。 默认值为 null
。
示例
以下示例演示如何设置 Background 元素的 FlowDocument 属性。
<FlowDocumentReader>
<FlowDocument
Background="IndianRed"
Foreground="NavajoWhite"
>
<Paragraph>
This FlowDocument will have a background color of Indian red, with the text
colored Navajo white. Any Forground or Background settings on this paragraph
would override the top-level settings for the FlowDocument.
</Paragraph>
</FlowDocument>
</FlowDocumentReader>
下面的示例演示如何以编程方式设置 Background 属性。
FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content...")));
flowDoc.Background = Brushes.IndianRed;
flowDoc.Foreground = Brushes.NavajoWhite;
Dim flowDoc As New FlowDocument(New Paragraph(New Run("A bit of text content...")))
flowDoc.Background = Brushes.IndianRed
flowDoc.Foreground = Brushes.NavajoWhite
注解
有关显示可用预定义画笔颜色的样本表,请参阅 Brushes。
依赖项属性信息
标识符字段 | BackgroundProperty |
元数据属性设置为 true |
AffectsRender |