Share via


FlowDocument.PagePadding 屬性

定義

取得或設定值,指出頁面界限和頁面內容之間的填補空間寬度。

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

屬性值

指定套用於與裝置無關的像素計算之填補數量的 Thickness 結構。 預設值是粗細一致的零 (0.0)。

範例

下列範例顯示設定 PagePadding 專案屬性 FlowDocument 的各種方式。

<FlowDocumentReader>
  <FlowDocument PagePadding="10">
    <Paragraph>Padding is 10 pixels all around.</Paragraph>
  </FlowDocument>
</FlowDocumentReader>

<FlowDocumentReader>
  <FlowDocument PagePadding="1.5in">
    <Paragraph>Padding is 1 and a half inches all around.</Paragraph>
  </FlowDocument>
</FlowDocumentReader>

<FlowDocumentReader>
  <FlowDocument PagePadding="5,10,5,10">
    <Paragraph>Padding is 5 pixels on the right and left, and 10 pixels on the top and botton.</Paragraph>
  </FlowDocument>
</FlowDocumentReader>

<FlowDocumentReader>
  <FlowDocument PagePadding="0.8in,20,0.8in,20">
    <Paragraph>Padding is 1 eigth of an inch on the right and left, and 20 pixels on the top and botton.</Paragraph>
  </FlowDocument>
</FlowDocumentReader>

下列範例示範如何以程式設計方式設定 PagePadding 屬性。

FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content...")));

// Padding is 10 pixels all around.
flowDoc.PagePadding = new Thickness(10);
// Padding is 5 pixels on the right and left, and 10 pixels on the top and botton.
flowDoc.PagePadding = new Thickness(5, 10, 5, 10);
Dim flowDoc As New FlowDocument(New Paragraph(New Run("A bit of text content...")))

' Padding is 10 pixels all around.
flowDoc.PagePadding = New Thickness(10)
' Padding is 5 pixels on the right and left, and 10 pixels on the top and botton.
flowDoc.PagePadding = New Thickness(5, 10, 5, 10)

備註

PagePadding 可以描述為 () PagePadding="10" 的所有方向一致,或分別代表左、上、右和下邊框間距的四個相異值, (PagePadding="5,0,10,20") 。

例如,如果指定的邊框間距粗細超過對應的頁面維度 (,則左右填補寬度的總和會超過頁面寬度) ,則邊框間距的粗細會相應減少為不大於相關的頁面維度。

XAML Attribute Usage

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

XAML 值

uniformThickness
Double 一值的字串表示,以統一套用至這四個粗細尺寸。 例如,的值 "10" 相當於 的值 "10,10,10,10" 。 不合格的值是以裝置獨立圖元來測量。 字串不需要明確包含小數點。

independentThickness
四個已排序 Double 值的字串表示,以這個順序對應至左、上、右和下的獨立粗細維度。 四個值必須以逗號分隔;不允許空格。 例如,「5,10,15,20」 會產生 5 圖元的填補到內容左邊、內容上方 10 圖元填補、內容右邊 15 圖元填補,以及內容下方 20 圖元的填補。

qualifiedUniformThickness
uniformThickness所描述的值,後面接著下列其中一個單位規範: pxin

px (預設) 是裝置獨立單位 (每單位 1/96 英吋)

in 為英吋;1in==96px

例如, "1in" 提供所有方向 1 英吋的統一邊框間距。

qualifiedIndependentThickness
independentThickness所描述的值,每個獨立值後面接著下列其中一個單位規範: pxin

px (預設) 是裝置獨立單位 (每單位 1/96 英吋)

in 為英吋;1in==96px

例如: "1.5in,0.8in,1.5in,0.8in" 。 單位規範可以混合或省略一或多個值。

相依性屬性資訊

識別碼欄位 PagePaddingProperty
設定為 的中繼資料屬性 true AffectsMeasure

適用於