Lire en anglais

Partager via


FlowDocument.Background Propriété

Définition

Obtient ou définit le Brush utilisé pour remplir l'arrière-plan de la zone de contenu.

C#
public System.Windows.Media.Brush Background { get; set; }

Valeur de propriété

Pinceau permettant de remplir l'arrière-plan de la zone du contenu, ou null pour ne pas utiliser de pinceau d'arrière-plan. La valeur par défaut est null.

Exemples

L’exemple suivant montre comment définir l’attribut Background d’un FlowDocument élément.

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

L’exemple suivant montre comment définir la Background propriété par programmation.

C#
FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content...")));
flowDoc.Background = Brushes.IndianRed;
flowDoc.Foreground = Brushes.NavajoWhite;

Remarques

Pour obtenir une table de nuances qui affichent les couleurs de pinceau prédéfinies disponibles, consultez Brushes.

Informations sur les propriétés de dépendance

Champ Identificateur BackgroundProperty
Propriétés de métadonnées définies sur true AffectsRender

S’applique à

Produit Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9