Spread Windows Forms 6.0 Product Documentation
OwnerPrintDraw(Graphics,Rectangle,Int32,Int32) Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > FpSpread Class : OwnerPrintDraw(Graphics,Rectangle,Int32,Int32) Method


g
Graphics device that handles printing
rect
Location and size of a rectangular region
sheet
Sheet from which to print
page
Specific page of the sheet to print

Glossary Item Box

Prints the specified page of the specified sheet to a specified graphics interface with the specified size.

Syntax

Visual Basic (Declaration) 
Public Sub OwnerPrintDraw( _
   ByVal g As Graphics, _
   ByVal rect As Rectangle, _
   ByVal sheet As Integer, _
   ByVal page As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As FpSpread
Dim g As Graphics
Dim rect As Rectangle
Dim sheet As Integer
Dim page As Integer
 
instance.OwnerPrintDraw(g, rect, sheet, page)
C# 
public void OwnerPrintDraw( 
   Graphics g,
   Rectangle rect,
   int sheet,
   int page
)

Parameters

g
Graphics device that handles printing
rect
Location and size of a rectangular region
sheet
Sheet from which to print
page
Specific page of the sheet to print

Exceptions

ExceptionDescription
System.ArgumentOutOfRangeException Specified sheet index is out of range; must be between zero and the total number of sheets
System.ArgumentOutOfRangeException Specified page index is out of range; must be greater than one

Example

This example prints page 1 of two different sheets.  Add a PrintDocument control to the form.
C#Copy Code
private void button1_Click(object sender, EventArgs e)
        {
            printDocument1.Print();            
        }
       
private void Form1_Load(object sender, EventArgs e)
        {
            fpSpread1.Sheets.Count = 2;
            fpSpread1.Sheets[0].Cells[0, 0].Value = "test";
            fpSpread1.Sheets[1].Cells[0, 0].Value = "test";
           }

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Rectangle rect;
            rect = new Rectangle(0, 0, 100, 100);
            fpSpread1.OwnerPrintDraw(e.Graphics, rect, 0, 1);

            Rectangle rect1;
            rect1 = new Rectangle(0, 200, 100, 100);
            fpSpread1.OwnerPrintDraw(e.Graphics, rect1, 1, 1);            
        }
Visual BasicCopy Code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        PrintDocument1.Print()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        FpSpread1.Sheets.Count = 2
        FpSpread1.Sheets(0).Cells(0, 0).Value = "test"
        FpSpread1.Sheets(1).Cells(0, 0).Value = "test"
End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        Dim rect As Rectangle
        rect = New Rectangle(0, 0, 100, 100)
        FpSpread1.OwnerPrintDraw(e.Graphics, rect, 0, 1)

        Dim rect1 As Rectangle
        rect1 = New Rectangle(0, 200, 100, 100)
        FpSpread1.OwnerPrintDraw(e.Graphics, rect1, 1, 1)
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.