Block.TextAlignment プロパティ
定義
テキスト コンテンツの水平方向の配置を取得または設定します。Gets or sets the horizontal alignment of text content.
public:
property System::Windows::TextAlignment TextAlignment { System::Windows::TextAlignment get(); void set(System::Windows::TextAlignment value); };
public System.Windows.TextAlignment TextAlignment { get; set; }
member this.TextAlignment : System.Windows.TextAlignment with get, set
Public Property TextAlignment As TextAlignment
プロパティ値
目的の配置を指定する、いずれかの TextAlignment 値。One of the TextAlignment values that specifies the desired alignment. 既定値は、Left です。The default is Left.
例
要素の属性TextAlignmentを設定する方法を次の例に示します。 BlockThe following example shows how to set the TextAlignment attribute of a Block element.
<FlowDocument>
<Paragraph Background="GhostWhite" TextAlignment="Center">
One<LineBreak/>
two two<LineBreak/>
Three Three Three<LineBreak/>
four four four four<LineBreak/>
Five Five Five Five Five<LineBreak/>
six six six six six six<LineBreak/>
Seven Seven Seven Seven Seven Seven Seven<LineBreak/>
eight eight eight eight eight eight eight eight
</Paragraph>
</FlowDocument>
次の図は、前の例がテキストLeftの配置 (既定値) でどのようにレンダリングされるかを示しています。The following figure shows how the preceding example renders with Left text alignment (the default).
![スクリーン]Left(~/add/media/flowdoc-textalign-left.png "スクリーンショットの TextAlign プロパティ値:TextAlign プロパティの値 Left")
次の図は、同じ例をテキストのRight配置でレンダリングする方法を示しています。The following figure shows how the same example renders with Right text alignment.
![スクリーン]右(~/add/media/flowdoc-textalign-right.png "のスクリーンショットの TextAlign の値:Right の TextAlign 値")
次の図は、同じ例をテキストのCenter配置でレンダリングする方法を示しています。The following figure shows how the same example renders with Center text alignment.
![スクリーン]Center(~/add/media/flowdoc-textalign-center.png "スクリーンショットの TextAlign プロパティ値:TextAlign プロパティの値 (中央)")
次の例では、プログラムをTextAlignment使用してプロパティを設定する方法を示します。The following example shows how to set the TextAlignment property programmatically.
Paragraph par = new Paragraph();
par.TextAlignment = TextAlignment.Center;
Dim par As New Paragraph()
par.TextAlignment = TextAlignment.Center
注釈
依存プロパティ情報Dependency Property Information
識別子フィールドIdentifier field | TextAlignmentProperty |
メタデータプロパティがに設定されるtrue Metadata properties set to true |
AffectsMeasure、 AffectsRender、 InheritsAffectsMeasure, AffectsRender, Inherits |