Block.BorderThickness プロパティ

定義

要素の境界線の太さを取得または設定します。

public:
 property System::Windows::Thickness BorderThickness { System::Windows::Thickness get(); void set(System::Windows::Thickness value); };
public System.Windows.Thickness BorderThickness { get; set; }
member this.BorderThickness : System.Windows.Thickness with get, set
Public Property BorderThickness As Thickness

プロパティ値

Thickness

適用する境界線の量を指定する Thickness 構造体。デバイス非依存のピクセル単位で指定します。 既定では 0 (0.0) の均一の幅です。

次の例は、要素 (Paragraph) の属性をBorderThickness設定する方法をBlock示しています。

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

次の図は、前の例がどのようにレンダリングされるかを示しています。

スクリーンショット: 青、1/4 インチの境界線 (ブロックの周囲)

次の例では、BorderThickness プロパティをプログラムで設定する方法を示しています。

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)

注釈

XAML 属性の使用方法

<object BorderThickness="uniformThickness"/>  
- or -  
<object BorderThickness="independentThickness"/>  
- or -  
<object BorderThickness="qualifiedUniformThickness"/>  
- or -  
<object BorderThickness="qualifiedIndependentThickness"/>  

XAML 値

uniformThickness
4 つの厚み寸法すべてに均一に適用する 1 つの Double 値の文字列表現。 たとえば、値の "10" 値は "10,10,10,10".. 非修飾値は、デバイスに依存しないピクセル単位で測定されます。 文字列に小数点を明示的に含める必要はありません。

independentThickness
左、上、右、および下の独立した厚さ寸法に対応する 4 つの順序付け Double された値の文字列表現を、この順序で指定します。 4 つの値はコンマで区切る必要があります。スペースは使用できません。 たとえば、"5,10,15,20" は、コンテンツの左側に 5 ピクセルの境界線、コンテンツの上に 10 ピクセル、コンテンツの右側に 15 ピクセルの境界線、およびコンテンツの下に 20 ピクセルの境界線が表示されます。

qualifiedUniformThickness
uniformThickness で記述された値の後に、次のいずれかの単位指定子が続きます。 px``in

px (既定値) はデバイスに依存しない単位 (ユニットあたり 1/96 インチ) です

in はインチ。1in==96px

たとえば、 "1in" すべての方向に 1 インチの均一な境界線を提供します。

qualifiedIndependentThickness
independentThickness で記述された値。各独立値の後に次のいずれかの単位指定子が続きます。 px``in

px (既定値) はデバイスに依存しない単位 (ユニットあたり 1/96 インチ) です

in はインチ。1in==96px

たとえば、「 "1.5in,0.8in,1.5in,0.8in" 」のように入力します。 単位指定子は、1 つ以上の値から混合または省略できます。

依存プロパティ情報

識別子フィールド BorderThicknessProperty
に設定されたメタデータ プロパティ true AffectsMeasure

適用対象

こちらもご覧ください