PageContent 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 PageContent 類別的新執行個體。
public:
PageContent();
public PageContent ();
Public Sub New ()
範例
下列範例顯示建構函式的使用 PageContent 方式。
// --------------------- CreateFifthPageContent -----------------------
/// <summary>
/// Creates the content for the fifth fixed page.</summary>
/// <returns>
/// The page content for the fifth fixed page.</returns>
private PageContent CreateFifthPageContent()
{
PageContent pageContent = new PageContent();
FixedPage fixedPage = new FixedPage();
UIElement visual = CreateThirdVisual(false);
FixedPage.SetLeft(visual, 0);
FixedPage.SetTop(visual, 0);
double pageWidth = 96 * 8.5;
double pageHeight = 96 * 11;
fixedPage.Width = pageWidth;
fixedPage.Height = pageHeight;
fixedPage.Children.Add((UIElement)visual);
Size sz = new Size(8.5 * 96, 11 * 96);
fixedPage.Measure(sz);
fixedPage.Arrange(new Rect(new Point(), sz));
fixedPage.UpdateLayout();
((IAddChild)pageContent).AddChild(fixedPage);
return pageContent;
}// end:CreateFifthPageContent()
' --------------------- CreateFifthPageContent -----------------------
''' <summary>
''' Creates the content for the fifth fixed page.</summary>
''' <returns>
''' The page content for the fifth fixed page.</returns>
Private Function CreateFifthPageContent() As PageContent
Dim pageContent As New PageContent()
Dim fixedPage As New FixedPage()
Dim visual As UIElement = CreateThirdVisual(False)
FixedPage.SetLeft(visual, 0)
FixedPage.SetTop(visual, 0)
Dim pageWidth As Double = 96 * 8.5
Dim pageHeight As Double = 96 * 11
fixedPage.Width = pageWidth
fixedPage.Height = pageHeight
fixedPage.Children.Add(CType(visual, UIElement))
Dim sz As New Size(8.5 * 96, 11 * 96)
fixedPage.Measure(sz)
fixedPage.Arrange(New Rect(New Point(), sz))
fixedPage.UpdateLayout()
CType(pageContent, IAddChild).AddChild(fixedPage)
Return pageContent
End Function ' end:CreateFifthPageContent()