FlowDocument.Foreground 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置要应用到 FlowDocument 的文本内容的 Brush。
public:
property System::Windows::Media::Brush ^ Foreground { System::Windows::Media::Brush ^ get(); void set(System::Windows::Media::Brush ^ value); };
public System.Windows.Media.Brush Foreground { get; set; }
member this.Foreground : System.Windows.Media.Brush with get, set
Public Property Foreground As Brush
属性值
要应用于文本内容的画笔。 默认值为 Black。
示例
以下示例演示如何设置 Foreground 元素的 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>
下面的示例演示如何以编程方式设置 Foreground 属性。
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。
子元素上的任何 Foreground 设置都替代此顶级设置。
依赖项属性信息
标识符字段 | ForegroundProperty |
元数据属性设置为 true |
AffectsRender, Inherits, SubPropertiesDoNotAffectRender |