TextElement.Background Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit le pinceau utilisé pour remplir l’arrière-plan de la zone de contenu.
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
Valeur de propriété
Pinceau utilisé pour remplir l’arrière-plan de la zone de contenu ou null pour ne pas utiliser un pinceau d’arrière-plan. La valeur par défaut est null.
Exemples
L’exemple suivant montre comment définir l’attribut Background , à l’aide Paragraph de l’exemple d’élément.
<FlowDocumentReader>
<FlowDocument>
<Paragraph
Background="Bisque"
Foreground="DarkGreen"
Padding="4"
>
<Run>
This text has a foreground color of dark green, and a background color of bisque.
</Run>
</Paragraph>
</FlowDocument>
</FlowDocumentReader>
La figure suivante montre comment l’exemple précédent s’affiche.
L’exemple suivant montre comment définir la Background propriété par programmation.
Run run = new Run(
"This text has a foreground color of dark green, and a background color of bisque.");
Paragraph par = new Paragraph(run);
par.Background = Brushes.Bisque;
par.Foreground = Brushes.DarkGreen;
Dim run As New Run("This text has a foreground color of dark green, and a background color of bisque.")
Dim par As New Paragraph(run)
par.Background = Brushes.Bisque
par.Foreground = Brushes.DarkGreen
Remarques
Pour obtenir une table de nuances qui affiche les couleurs de pinceau prédéfinies disponibles, consultez Brushes.
Informations sur les propriétés de dépendance
| Élément | Valeur |
|---|---|
| Champ d’identificateur | BackgroundProperty |
Propriétés de métadonnées définies sur true |
AffectsRender |