FlowDocument.PageWidth 屬性

定義

取得或設定 FlowDocument 中頁面的慣用寬度。

public:
 property double PageWidth { double get(); void set(double value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))]
public double PageWidth { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))>]
member this.PageWidth : double with get, set
Public Property PageWidth As Double

屬性值

FlowDocument 中頁面的慣用寬度 (以與裝置無關的像素為單位)。 NaN 的值 (相當於 "Auto" 的屬性值) 會自動決定頁面寬度。 預設值為 NaN

屬性

範例

下列範例示範如何設定 PageWidth 專案的 屬性 FlowDocument

<FlowDocumentReader>
  <FlowDocument
    PageHeight="Auto"
    PageWidth="Auto"
    MinPageHeight="3in"
    MinPageWidth="5in"
    MaxPageHeight="6in"
    MaxPageWidth="10in"
  >
    <Paragraph Background="BlanchedAlmond">
      This uses automatic page sizing with minimum page size of 3 by 5 inches,
      and a maximum page size of 6 by 10 inches.
    </Paragraph>
  </FlowDocument>
</FlowDocumentReader>

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

FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content...")));
// Set PageHeight and PageWidth to "Auto".
flowDoc.PageHeight = Double.NaN;
flowDoc.PageWidth = Double.NaN;
// Specify minimum page sizes.
flowDoc.MinPageWidth = 680.0;
flowDoc.MinPageHeight = 480.0;
//Specify maximum page sizes.
flowDoc.MaxPageWidth = 1024.0;
flowDoc.MaxPageHeight = 768.0;
Dim flowDoc As New FlowDocument(New Paragraph(New Run("A bit of text content...")))
' Set PageHeight and PageWidth to "Auto".
flowDoc.PageHeight = Double.NaN
flowDoc.PageWidth = Double.NaN
' Specify minimum page sizes.
flowDoc.MinPageWidth = 680.0
flowDoc.MinPageHeight = 480.0
'Specify maximum page sizes.
flowDoc.MaxPageWidth = 1024.0
flowDoc.MaxPageHeight = 768.0

備註

如果在持續性上檢視,則 MinPageWidth 屬性會優先于 MaxPageWidth 屬性,而該屬性又優先于 PageWidth 屬性。 如果指定頁面上設定了這三個屬性,則這是評估屬性的順序。

XAML Attribute Usage

<object PageWidth="double"/>  
- or -  
<object PageWidth="qualifiedDouble"/>  
- or -  
<object PageWidth="Auto"/>  

XAML 值

double
Double

值等於或大於 0.0 但小於 Double.PositiveInfinityDouble 字串表示。 不合格的值是以裝置獨立圖元來測量。 字串不需要明確包含小數點。

qualifiedDouble
如上所述的 雙精度 浮點數,後面接著下列其中一個單位規範: px 、、 incmpt

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

in 為英吋;1in==96px

cm 為公分;1cm== (96/2.54) px

pt 為點;1pt== (96/72) px

Auto
讓頁面寬度自動決定。 相當於 的 Double.NaN 屬性值。

相依性屬性資訊

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

適用於