'宣言 Public ReadOnly Property Document As UltraPrintDocument
public UltraPrintDocument Document {get;}
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.Printing Private Sub UltraPrintDocument1_PagePrinting(ByVal sender As System.Object, ByVal e As Infragistics.Win.Printing.PagePrintingEventArgs) Handles UltraPrintDocument1.PagePrinting ' the page printing event can be used to cancel the print ' operation completely or used to adjust some settings of ' the various page sections. for example, if you were ' inserting a title page, you probably wouldn't want ' the header or footer to render, so you can explicitly ' set their height to 0 If e.Document.PageNumber = 1 Then e.Document.Header.Height = 0 e.Document.Footer.Height = 0 Else e.Document.PageNumber = 1 Then ' then for all subsequent pages, the header and ' footer height should be automatically calculated ' based on the contents (text, padding, border, margins,etc). e.Document.Header.Height = -1 e.Document.Footer.Height = -1 End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.Printing; private void ultraPrintDocument1_PagePrinting(object sender, Infragistics.Win.Printing.PagePrintingEventArgs e) { // the page printing event can be used to cancel the print // operation completely or used to adjust some settings of // the various page sections. for example, if you were // inserting a title page, you probably wouldn't want // the header or footer to render, so you can explicitly // set their height to 0 if (e.Document.PageNumber == 1) { e.Document.Header.Height = 0; e.Document.Footer.Height = 0; } else (e.Document.PageNumber == 1) { // then for all subsequent pages, the header and // footer height should be automatically calculated // based on the contents (text, padding, border, margins,etc). e.Document.Header.Height = -1; e.Document.Footer.Height = -1; } }