Spread Windows Forms 6.0 Product Documentation
GetOwnerPrintPageCount Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > FpSpread Class : GetOwnerPrintPageCount Method


g
Graphics object that handles printing
rect
Rectangle area representing the area for printing
sheet
Sheet to print

Glossary Item Box

Gets the number of pages required to print a given sheet into the supplied rectangle.

Syntax

Visual Basic (Declaration) 
Public Function GetOwnerPrintPageCount( _
   ByVal g As Graphics, _
   ByVal rect As Rectangle, _
   ByVal sheet As Integer _
) As Integer
Visual Basic (Usage)Copy Code
Dim instance As FpSpread
Dim g As Graphics
Dim rect As Rectangle
Dim sheet As Integer
Dim value As Integer
 
value = instance.GetOwnerPrintPageCount(g, rect, sheet)
C# 
public int GetOwnerPrintPageCount( 
   Graphics g,
   Rectangle rect,
   int sheet
)

Parameters

g
Graphics object that handles printing
rect
Rectangle area representing the area for printing
sheet
Sheet to print

Return Value

Integer number of pages on which to print the sheet

Example

This example shows setting the page printing.
C#Copy Code
private System.Drawing.Printing.PrintDocument pd;
this.pd = new System.Drawing.Printing.PrintDocument();
this.pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.pd_PrintPage);

private void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs ev)
{
     Rectangle rect = new Rectangle(ev.PageBounds.X, ev.PageBounds.Y, ev.PageBounds.Width/2, ev.PageBounds.Height/2);
     int cnt = fpSpread1.GetOwnerPrintPageCount(ev.Graphics, rect, 0);
     fpSpread1.OwnerPrintDraw(ev.Graphics, rect, 0, cnt);
     ev.Graphics.DrawString("End of Print Job", new Font("MS Sans Serif", 10), new SolidBrush(Color.Black), new Rectangle(ev.PageBounds.X,
ev.PageBounds.Y + ev.PageBounds.Height/2, ev.PageBounds.Width/2, ev.PageBounds.Height/2));
     ev.HasMorePages = false;
}
Visual BasicCopy Code
Friend WithEvents pd As System.Drawing.Printing.PrintDocument
Me.pd = New System.Drawing.Printing.PrintDocument()

Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As System.Drawing.Printing.PrintPageEventArgs) Handles pd.PrintPage
     Dim rect As New Rectangle(ev.PageBounds.X, ev.PageBounds.Y, ev.PageBounds.Width / 2, ev.PageBounds.Height / 2)
     Dim cnt As Integer = FpSpread1.GetOwnerPrintPageCount(ev.Graphics, rect, 0)
     FpSpread1.OwnerPrintDraw(ev.Graphics, rect, 0, cnt)
     ev.Graphics.DrawString("End of Print Job", New Font("MS Sans Serif", 10), New SolidBrush(Color.Black), ev.PageBounds.X,
ev.PageBounds.Y + ev.PageBounds.Height / 2)
     ev.HasMorePages = False
End Sub

Requirements

Target Platforms: 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

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.