AnchoredBlock.BorderBrush Właściwość

Definicja

Pobiera lub ustawia element Brush do użycia podczas malowania obramowania elementu.

public:
 property System::Windows::Media::Brush ^ BorderBrush { System::Windows::Media::Brush ^ get(); void set(System::Windows::Media::Brush ^ value); };
public System.Windows.Media.Brush BorderBrush { get; set; }
member this.BorderBrush : System.Windows.Media.Brush with get, set
Public Property BorderBrush As Brush

Wartość właściwości

Szczotka używana do zastosowania do obramowania elementu. Wartość domyślna to szczotka null .

Przykłady

W poniższym przykładzie pokazano, jak ustawić BorderBrush atrybut elementu (Paragraph).

<FlowDocument>
  <Paragraph Name="par"
    BorderBrush="Blue"
    BorderThickness="0.25in"
  >
    <Run>
      Child elements in this Block element (Paragraph) will be surrounded by a blue border.
    </Run>
    <LineBreak/><LineBreak/>
    <Run>
      This border will be one quarter inch thick in all directions.
    </Run>
  </Paragraph>
</FlowDocument>

Na poniższej ilustracji przedstawiono sposób renderowania tego przykładu.

Zrzut ekranu: Niebieski, 1/4 cala obramowanie wokół bloku

W poniższym przykładzie pokazano, jak programowo ustawić BorderBrush właściwość.

Paragraph par = new Paragraph();

Run run1 = new Run("Child elements in this Block element (Paragraph) will be surrounded by a blue border.");
Run run2 = new Run("This border will be one quarter inch thick in all directions.");

par.Inlines.Add(run1);
par.Inlines.Add(run2);

par.BorderBrush = Brushes.Blue;
ThicknessConverter tc = new ThicknessConverter();
par.BorderThickness = (Thickness)tc.ConvertFromString("0.25in");
Dim par As New Paragraph()

Dim run1 As New Run("Child elements in this Block element (Paragraph) will be surrounded by a blue border.")
Dim run2 As New Run("This border will be one quarter inch thick in all directions.")

par.Inlines.Add(run1)
par.Inlines.Add(run2)

par.BorderBrush = Brushes.Blue
Dim tc As New ThicknessConverter()
par.BorderThickness = CType(tc.ConvertFromString("0.25in"), Thickness)

Uwagi

Aby zapoznać się z tabelą próbek pokazujących dostępne wstępnie zdefiniowane kolory pędzla, zobacz Brushes.

Informacje dotyczące właściwości zależności

Pole identyfikatora BorderBrushProperty
Właściwości metadanych ustawione na true AffectsRender

Dotyczy

Zobacz też