BaselineAlignment 列舉
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
描述相對於已建立的文字基準,文字型項目的基準在垂直軸上的擺放方式。
public enum class BaselineAlignment
public enum BaselineAlignment
type BaselineAlignment =
Public Enum BaselineAlignment
- 繼承
欄位
Baseline | 3 | 對齊包含方塊實際基準的基準。 |
Bottom | 2 | 對齊包含方塊下邊緣的基準。 |
Center | 1 | 對齊包含方塊中央的基準。 |
Subscript | 6 | 對齊包含方塊之註標位置的基準。 |
Superscript | 7 | 對齊包含方塊之上標位置的基準。 |
TextBottom | 5 | 對齊文字基準下邊緣的基準。 |
TextTop | 4 | 對齊文字基準上邊緣的基準。 |
Top | 0 | 對齊包含方塊上邊緣的基準。 |
範例
下列範例示範如何使用 BaselineAlignment 屬性來對齊包含方塊內的文字 (,在此案例中為 Paragraph) 。
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<FlowDocumentReader>
<FlowDocument ColumnWidth="800">
<Paragraph Background="Blue">
<!-- The large text forces a large containing box size for the paragraph.
The smaller text fragments align themselves vertically within this
box according to their BaselineAlignment values. -->
<Span FontSize="40">Baseline:</Span>
<Span BaselineAlignment="Baseline">Baseline</Span>
<Span BaselineAlignment="Top">Top</Span>
<Span BaselineAlignment="Bottom">Bottom</Span>
<Span BaselineAlignment="Center">Center</Span>
</Paragraph>
<Paragraph Background="Green">
<!-- The BaselineAlignment values of Subscript and Superscript below
force the containing box to be larger then it normally would be. -->
<Span FontSize="40">Baseline:</Span>
<Span BaselineAlignment="Subscript">Subscript</Span>
<Span BaselineAlignment="Baseline">Baseline</Span>
<Span BaselineAlignment="Superscript">Superscript</Span>
</Paragraph>
<Paragraph Background="Yellow" LineHeight="60" LineStackingStrategy="BlockLineHeight">
<!-- A deliberate BlockLineHeight stacking strategy change, to show the difference between Top/TextTop
and Bottom/TextBottom-->
<Span FontSize="40" BaselineAlignment="Baseline">Baseline:</Span>
<Span BaselineAlignment="Top">Top</Span>
<Span BaselineAlignment="TextTop">TextTop</Span>
<Span BaselineAlignment="Bottom">Bottom</Span>
<Span BaselineAlignment="TextBottom">TextBottom</Span>
</Paragraph>
</FlowDocument>
</FlowDocumentReader>
</Page>
下圖顯示上述程式碼的結果。