共用方式為


FlowDocument.Foreground 屬性

定義

取得或設定要套用至 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

屬性值

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

適用於