TextElement.Background Propriedade

Definição

Recebe ou define o pincel usado para preencher o fundo da área de conteúdo.

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

Valor de Propriedade

O pincel usado para preencher o fundo da área de conteúdo, ou null para não usar o pincel de fundo. A predefinição é null.

Exemplos

O exemplo a seguir mostra como definir o atributo Background, usando Paragraph como o elemento de exemplo.

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

A figura seguinte mostra como o exemplo anterior se apresenta.

Captura de ecrã: Primeiro plano de verde, bisque de fundo

O exemplo a seguir mostra como definir a propriedade Background programaticamente.

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

Observações

Para uma tabela de amostras que mostram as cores de pincel predefinidas disponíveis, veja Brushes.

Informação de Propriedade de Dependência

Item Value
Campo identificador BackgroundProperty
Propriedades dos metadados definidas como true AffectsRender

Aplica-se a

Ver também