(I posted this in general discussion, but I think that was wrong place). Issue: I had no trouble creating a printable panel control using the documentation provided. However if I add header and footer height and text to the radprintdocument in the control, the panel is printed overtop of the header. How can I change so this doesn't happen? (code for print preview of printable panel pnlCashReceiptsSummary and of custom control below) Code I'm using for print preview:Dim doc As New RadPrintDocument()
doc.DefaultPageSettings.Landscape = True
doc.HeaderHeight = 100
doc.HeaderFont = New Font("Arial", 14, FontStyle.Bold)
doc.RightHeader = "AAAA"
doc.LeftHeader = "[Date Printed]"
doc.FooterHeight = 100
doc.FooterFont = New Font("Arial", 12)
doc.LeftFooter = GlobalVariables.CurrentDealer.Dealer_Fxd.DealerCode pnlCashReceiptsSummary.PrintPreview(doc) My Control : Imports Telerik.WinControls.UI
Imports System.Drawing.Printing
Public Class PrintablePanel
Inherits RadPanel
Implements IPrintable
Public Function BeginPrint(sender As RadPrintDocument, args As PrintEventArgs) As Integer Implements IPrintable.BeginPrint
Return 1
End Function
Public Function EndPrint(sender As RadPrintDocument, args As PrintEventArgs) As Boolean Implements IPrintable.EndPrint
Return True
End Function
Public Function GetSettingsDialog(document As RadPrintDocument) As Form Implements IPrintable.GetSettingsDialog
Return New PrintSettingsDialog(document)
End Function
Public Function PrintPage(pageNumber As Integer, sender As RadPrintDocument, args As PrintPageEventArgs) As Boolean Implements IPrintable.PrintPage
Dim bmp As New Bitmap(Me.Width, Me.Height)
Me.DrawToBitmap(bmp, New Rectangle(Point.Empty, Me.Size))
args.Graphics.DrawImage(bmp, Point.Empty)
Return False
End Function
Public Sub Print(ByVal doc As RadPrintDocument)
doc.AssociatedObject = Me
doc.Print()
End Sub
Public Sub PrintPreview(ByVal doc As RadPrintDocument)
doc.AssociatedObject = Me
Dim dialog As New RadPrintPreviewDialog(doc)
dialog.ThemeName = Me.ThemeName
dialog.ShowDialog()
End Sub
Private Function CreatePrintDocument() As RadPrintDocument
Dim doc As New RadPrintDocument()
doc.AssociatedObject = Me
Return doc
End Function
End Class
doc.DefaultPageSettings.Landscape = True
doc.HeaderHeight = 100
doc.HeaderFont = New Font("Arial", 14, FontStyle.Bold)
doc.RightHeader = "AAAA"
doc.LeftHeader = "[Date Printed]"
doc.FooterHeight = 100
doc.FooterFont = New Font("Arial", 12)
doc.LeftFooter = GlobalVariables.CurrentDealer.Dealer_Fxd.DealerCode pnlCashReceiptsSummary.PrintPreview(doc) My Control : Imports Telerik.WinControls.UI
Imports System.Drawing.Printing
Public Class PrintablePanel
Inherits RadPanel
Implements IPrintable
Public Function BeginPrint(sender As RadPrintDocument, args As PrintEventArgs) As Integer Implements IPrintable.BeginPrint
Return 1
End Function
Public Function EndPrint(sender As RadPrintDocument, args As PrintEventArgs) As Boolean Implements IPrintable.EndPrint
Return True
End Function
Public Function GetSettingsDialog(document As RadPrintDocument) As Form Implements IPrintable.GetSettingsDialog
Return New PrintSettingsDialog(document)
End Function
Public Function PrintPage(pageNumber As Integer, sender As RadPrintDocument, args As PrintPageEventArgs) As Boolean Implements IPrintable.PrintPage
Dim bmp As New Bitmap(Me.Width, Me.Height)
Me.DrawToBitmap(bmp, New Rectangle(Point.Empty, Me.Size))
args.Graphics.DrawImage(bmp, Point.Empty)
Return False
End Function
Public Sub Print(ByVal doc As RadPrintDocument)
doc.AssociatedObject = Me
doc.Print()
End Sub
Public Sub PrintPreview(ByVal doc As RadPrintDocument)
doc.AssociatedObject = Me
Dim dialog As New RadPrintPreviewDialog(doc)
dialog.ThemeName = Me.ThemeName
dialog.ShowDialog()
End Sub
Private Function CreatePrintDocument() As RadPrintDocument
Dim doc As New RadPrintDocument()
doc.AssociatedObject = Me
Return doc
End Function
End Class