Condividi tramite


FlowDocument.Background Proprietà

Definizione

Ottiene o imposta l'oggetto Brush utilizzato per riempire lo sfondo dell'area del contenuto.

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

Valore della proprietà

Pennello utilizzato per riempire lo sfondo dell'area del contenuto o null per non usare un pennello di sfondo. Il valore predefinito è null.

Esempio

Nell'esempio seguente viene illustrato come impostare l'attributo Background di un FlowDocument elemento .

<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>

Nell'esempio seguente viene illustrato come impostare la proprietà Background a livello di codice.

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

Commenti

Per una tabella di campioni che mostrano i colori del pennello predefiniti disponibili, vedere Brushes.

Informazioni sulle proprietà di dipendenza

Elemento Valore
Campo Identificatore BackgroundProperty
Proprietà dei metadati impostate su true AffectsRender

Si applica a