共用方式為


FlowDocument.Background 屬性

定義

取得或設定用來填滿內容區域背景的 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

適用於