組件： PresentationFramework (在 presentationframework.dll 中)
XML 命名空間： http://schemas.microsoft.com/winfx/2006/xaml/presentation
/** @property */ public TextAlignment get_TextAlignment () /** @property */ public void set_TextAlignment (TextAlignment value)
public function get TextAlignment () : TextAlignment public function set TextAlignment (value : TextAlignment)
屬性值A member of the TextAlignment enumerations specifying the desired alignment. The default value is Left.
The 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>
The following figure shows how the previous example renders with Left text alignment (the default).
The following figure shows how the same example renders with Right text alignment.
The following figure shows how the same example renders with Center text alignment.
The following example shows how to set the TextAlignment property programmatically.