バージョン

UltraPrintDocument クラス

ページヘッダーとフッターを持つ印刷ドキュメントを描画するための基本クラス。
シンタックス
'宣言
 
Public Class UltraPrintDocument 
   Inherits System.Drawing.Printing.PrintDocument
public class UltraPrintDocument : System.Drawing.Printing.PrintDocument 
解説

UltraPrintDocument は、カスタムのページ ヘッダーおよびフッターの組み込みサポートが追加された特別な System.Drawing.Printing.PrintDocument です (HeaderFooter を参照)。

プロパティ設定は、SaveAsXml(Stream) メソッドまたは SaveAsBinary(Stream) メソッドを使用して保存できます。シリアル化された設定は、それぞれ LoadFromXml(Stream) メソッドまたは LoadFromBinary(Stream) メソッドを使用して読み込みできます。

System.Drawing.Printing.PrintDocument.DefaultPageSettings などの基本 PrintDocument クラスのプロパティ設定は、SaveAsXml または SaveAsBinary メソッドではシリアル化されません。

使用例
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Printing

        ' the print document exposes a 'PrintColorStyle' although
        ' it is up to the implementation to honor this. the default
        ' appearances and pagesections will honor this setting
        Me.UltraPrintDocument1.PrintColorStyle = ColorRenderMode.GrayScale

        ' the header and footer can have text aligned within
        ' the section and can include replaceable tokens
        Me.UltraPrintDocument1.Header.TextLeft = "[User Name]"
        Me.UltraPrintDocument1.Header.TextCenter = Me.UltraPrintDocument1.DocumentName
        Me.UltraPrintDocument1.Header.TextRight = "[Date Printed]"

        ' the header is a derived page section and therefore
        ' can have a border and control over which sides render
        ' the border
        Me.UltraPrintDocument1.Header.BorderStyle = UIElementBorderStyle.Solid
        Me.UltraPrintDocument1.Header.BorderSides = Border3DSide.Bottom

        ' initialize the text that will appear in the footer.
        ' this can be replaceable tokens that will insert the
        ' time, page number, etc.
        Me.UltraPrintDocument1.Footer.TextLeft = "[Time Printed]"
        Me.UltraPrintDocument1.Footer.TextRight = "[Page #]"

        ' the height of the section will be calculated automatically
        ' based on the contents but may be explicitly controlled
        ' using the height property
        'this.ultraPrintDocument1.Footer.Height

        ' the section text can be setup to switch on 
        ' alternate pages
        Me.UltraPrintDocument1.Footer.ReverseTextOnEvenPages = True

        ' add extra space our the page body
        Me.UltraPrintDocument1.PageBody.Margins.Top = 5
        Me.UltraPrintDocument1.PageBody.Margins.Bottom = 5

        ' the page property is the section representing the
        ' entire renderable area of the page. you can assign
        ' a border around the margin area
        Me.UltraPrintDocument1.Page.BorderStyle = UIElementBorderStyle.Solid

        ' and then use the padding to provide space between the
        ' border and contents (header, footer, pagebody)
        Me.UltraPrintDocument1.Page.Padding.Left = 2
        Me.UltraPrintDocument1.Page.Padding.Right = 2
        Me.UltraPrintDocument1.Page.Padding.Top = 2
        Me.UltraPrintDocument1.Page.Padding.Bottom = 2

        ' the appearance of the page will affect only the page itself
        Me.UltraPrintDocument1.Page.Appearance.BorderColor = Color.Black

        ' the appearance property will affect all sections
        Me.UltraPrintDocument1.Appearance.ForeColor = Color.Black
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Printing;

			// the print document exposes a 'PrintColorStyle' although
			// it is up to the implementation to honor this. the default
			// appearances and pagesections will honor this setting
			this.ultraPrintDocument1.PrintColorStyle = ColorRenderMode.GrayScale;

			// the header and footer can have text aligned within
			// the section and can include replaceable tokens
			this.ultraPrintDocument1.Header.TextLeft = "[User Name]";
			this.ultraPrintDocument1.Header.TextCenter = this.ultraPrintDocument1.DocumentName;
			this.ultraPrintDocument1.Header.TextRight = "[Date Printed]";

			// the header is a derived page section and therefore
			// can have a border and control over which sides render
			// the border
			this.ultraPrintDocument1.Header.BorderStyle = UIElementBorderStyle.Solid;
			this.ultraPrintDocument1.Header.BorderSides = Border3DSide.Bottom;

			// initialize the text that will appear in the footer.
			// this can be replaceable tokens that will insert the
			// time, page number, etc.
			this.ultraPrintDocument1.Footer.TextLeft = "[Time Printed]";
			this.ultraPrintDocument1.Footer.TextRight = "[Page #]";

			// the height of the section will be calculated automatically
			// based on the contents but may be explicitly controlled
			// using the height property
			//this.ultraPrintDocument1.Footer.Height

			// the section text can be setup to switch on 
			// alternate pages
			this.ultraPrintDocument1.Footer.ReverseTextOnEvenPages = true;

			// add extra space our the page body
			this.ultraPrintDocument1.PageBody.Margins.Top = 5;
			this.ultraPrintDocument1.PageBody.Margins.Bottom = 5;

			// the page property is the section representing the
			// entire renderable area of the page. you can assign
			// a border around the margin area
			this.ultraPrintDocument1.Page.BorderStyle = UIElementBorderStyle.Solid;

			// and then use the padding to provide space between the
			// border and contents (header, footer, pagebody)
			this.ultraPrintDocument1.Page.Padding.Left = 2;
			this.ultraPrintDocument1.Page.Padding.Right = 2;
			this.ultraPrintDocument1.Page.Padding.Top = 2;
			this.ultraPrintDocument1.Page.Padding.Bottom = 2;

			// the appearance of the page will affect only the page itself
			this.ultraPrintDocument1.Page.Appearance.BorderColor = Color.Black;

			// the appearance property will affect all sections
			this.ultraPrintDocument1.Appearance.ForeColor = Color.Black;
参照