FlowDocument.Background 属性
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置要用于填充内容区域背景的 Brush。
public:
property System::Windows::Media::Brush ^ Background { System::Windows::Media::Brush ^ get(); void set(System::Windows::Media::Brush ^ value); };
C#
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 属性。
XAML
<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 属性。
C#
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 |
产品 | 版本 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |