Block.BorderBrush Property

Definition

Ottiene o imposta un oggetto Brush da utilizzare per disegnare il bordo dell'elemento.Gets or sets a Brush to use when painting the element's border.

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

Property Value

Brush

Pennello utilizzato per applicare il bordo dell'elemento.The brush used to apply to the element's border. Il valore predefinito è null.The default is null.

Examples

Nell'esempio seguente viene illustrato come impostare l'attributo BorderBrush di un elemento Block (Paragraph).The following example shows how to set the BorderBrush attribute of a Block element (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>

Nella figura seguente viene illustrato il rendering dell'esempio precedente.The following figure shows how the preceding example renders.

Screenshot: blu, 1/4inch bordo intorno al bloccoScreenshot: Blue, 1/4inch border around Block

Nell'esempio seguente viene illustrato come impostare la proprietà BorderBrush a livello di codice.The following example shows how to set the BorderBrush property programmatically.

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)

Remarks

Per una tabella di campioni che mostra i colori del pennello predefiniti disponibili, vedere Brushes.For a table of swatches that show the available predefined brush colors, see Brushes.

Informazioni proprietà di dipendenzaDependency Property Information

Campo identificatoreIdentifier field BorderBrushProperty
Proprietà dei metadati impostate su trueMetadata properties set to true AffectsRender

Applies to

See also