Version

PageHeaderPrinting Event

Fired before the Header is rendered
Syntax
'Declaration
 
Public Event PageHeaderPrinting As HeaderFooterPrintingEventHandler
public event HeaderFooterPrintingEventHandler PageHeaderPrinting
Event Data

The event handler receives an argument of type HeaderFooterPrintingEventArgs containing data related to this event. The following HeaderFooterPrintingEventArgs properties provide information specific to this event.

PropertyDescription
Document (Inherited from Infragistics.Win.Printing.PageSectionPrintEventArgs)Returns the document that is being rendered.
Graphics (Inherited from Infragistics.Win.Printing.PageSectionPrintEventArgs)Returns the graphics object into which the page should be rendered
Handled Returns or sets whether the default rendering should occur for the page background and border.
PageSettings (Inherited from Infragistics.Win.Printing.PageSectionPrintEventArgs)Returns the System.Drawing.Printing.PageSettings associated with the current page being printed.
RectInsideBorders (Inherited from Infragistics.Win.Printing.PageSectionPrintEventArgs)Returns the area of the section within its borders
RectInsideMargins (Inherited from Infragistics.Win.Printing.PageSectionPrintEventArgs)Returns the area of the section within its margins
RectInsidePadding (Inherited from Infragistics.Win.Printing.PageSectionPrintEventArgs)Returns the area of the section inside the borders.
RectOverall (Inherited from Infragistics.Win.Printing.PageSectionPrintEventArgs)Returns the area available for the section.
Section Returns the header or footer section being rendered.
Example
The following example demonstrates the PageHeaderPrinting and PageHeaderPrinted events.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Printing

    Private Sub UltraPrintDocument1_PageHeaderPrinting(ByVal sender As Object, ByVal e As Infragistics.Win.Printing.HeaderFooterPrintingEventArgs) Handles UltraPrintDocument1.PageHeaderPrinting
        ' the handled property can be used to prevent the 
        ' header from rendering itself and can also be used
        ' to custom render the header
        If e.Document.PageNumber = 1 Then
            e.Handled = True
        End If
    End Sub

    Private Sub UltraPrintDocument1_PageHeaderPrinted(ByVal sender As Object, ByVal e As Infragistics.Win.Printing.HeaderFooterPrintedEventArgs) Handles UltraPrintDocument1.PageHeaderPrinted
        ' the PageHeaderPrinted is invoked after the page header
        ' has been rendered and can be used to draw something on
        ' top of the header
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Printing;

		private void ultraPrintDocument1_PageHeaderPrinting(object sender, Infragistics.Win.Printing.HeaderFooterPrintingEventArgs e)
		{
			// the handled property can be used to prevent the 
			// header from rendering itself and can also be used
			// to custom render the header
			if (e.Document.PageNumber == 1)
				e.Handled = true;
		}

		private void ultraPrintDocument1_PageHeaderPrinted(object sender, Infragistics.Win.Printing.HeaderFooterPrintedEventArgs e)
		{
			// the PageHeaderPrinted is invoked after the page header
			// has been rendered and can be used to draw something on
			// top of the header
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also