Infragistics(R) NetAdvantage(R) Windows Forms
CancelableLogicalPrintPageEventArgs Class
Members  Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : CancelableLogicalPrintPageEventArgs Class

Event parameters used for Logical Print Page event

Syntax

Visual Basic (Declaration) 
Public Class CancelableLogicalPrintPageEventArgs 
   Inherits System.ComponentModel.CancelEventArgs
C# 
public class CancelableLogicalPrintPageEventArgs : System.ComponentModel.CancelEventArgs 

Example

InitializeLogicalPrintPage is fired for each page that's being printed or previewed. Following code shows some of the information available in the event.

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.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub UltraGrid1_InitializeLogicalPrintPage(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CancelableLogicalPrintPageEventArgs) Handles ultraGrid1.InitializeLogicalPrintPage

       Debug.WriteLine("e.Collate = " & e.Collate.ToString())
       Debug.WriteLine("e.Copies = " & e.Copies.ToString())
       Debug.WriteLine("e.DocumentName = " & e.DocumentName)
       Debug.WriteLine("e.Landscape = " & e.Landscape)
       Debug.WriteLine("e.LogicalPageNumber = " & e.LogicalPageNumber)
       Debug.WriteLine("e.DocumentName = " & e.MarginBottom)
       Debug.WriteLine("e.DocumentName = " & e.MarginLeft)
       Debug.WriteLine("e.DocumentName = " & e.MarginRight)
       Debug.WriteLine("e.DocumentName = " & e.MarginTop)
       Debug.WriteLine("e.DocumentName = " & e.PaperHeight)
       Debug.WriteLine("e.DocumentName = " & e.PaperWidth)
       Debug.WriteLine("e.DocumentName = " & e.PrintColors)
       Debug.WriteLine("e.DocumentName = " & e.PrinterName)
       Debug.WriteLine("e.DocumentName = " & e.PrintRange)
       Debug.WriteLine("e.DocumentName = " & e.DocumentName)

       ' You can also setup the footer and header on a per page basis.
       e.LogicalPageLayoutInfo.PageHeader = "Page Title"
       e.LogicalPageLayoutInfo.PageHeaderAppearance.ForeColor = Color.DarkGray

       e.LogicalPageLayoutInfo.PageFooter = "Page Footer Text"
       e.LogicalPageLayoutInfo.PageFooterAppearance.TextHAlign = HAlign.Center

       ' Following code cancels the event to prevent prevewing or printing more than 10 pages.
       If e.LogicalPageNumber > 10 Then
           e.Cancel = True
       End If

   End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void ultraGrid1_InitializeLogicalPrintPage(object sender, Infragistics.Win.UltraWinGrid.CancelableLogicalPrintPageEventArgs e)
{

	Debug.WriteLine( "e.Collate = " + e.Collate.ToString( ) );
	Debug.WriteLine( "e.Copies = " + e.Copies.ToString( ) );
	Debug.WriteLine( "e.DocumentName = " + e.DocumentName  );
	Debug.WriteLine( "e.Landscape = " + e.Landscape );
	Debug.WriteLine( "e.LogicalPageNumber = " + e.LogicalPageNumber );
	Debug.WriteLine( "e.DocumentName = " + e.MarginBottom );
	Debug.WriteLine( "e.DocumentName = " + e.MarginLeft );
	Debug.WriteLine( "e.DocumentName = " + e.MarginRight );
	Debug.WriteLine( "e.DocumentName = " + e.MarginTop );
	Debug.WriteLine( "e.DocumentName = " + e.PaperHeight );
	Debug.WriteLine( "e.DocumentName = " + e.PaperWidth );
	Debug.WriteLine( "e.DocumentName = " + e.PrintColors );
	Debug.WriteLine( "e.DocumentName = " + e.PrinterName );
	Debug.WriteLine( "e.DocumentName = " + e.PrintRange );
	Debug.WriteLine( "e.DocumentName = " + e.DocumentName  );

	// You can also setup the footer and header on a per page basis.
	e.LogicalPageLayoutInfo.PageHeader = "Page Title";
	e.LogicalPageLayoutInfo.PageHeaderAppearance.ForeColor = Color.DarkGray;
			
	e.LogicalPageLayoutInfo.PageFooter = "Page Footer Text";
	e.LogicalPageLayoutInfo.PageFooterAppearance.TextHAlign = HAlign.Center;

      // Following code cancels the event to prevent prevewing or printing more than 10 pages.
	if ( e.LogicalPageNumber > 10 )
		e.Cancel = true;

}

See Also