共用方式為


FlowDocument.Foreground 屬性

定義

取得或設定 Brush 將 套用到 的文字內容 FlowDocument

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>

下列示範如何以程式設計的方式設定 Typography 屬性。

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 Microsoft.Authorization/*/write、 、 Microsoft.Network/vpnGateways/*

SubPropertiesDoNotAffectRender

適用於