Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Add PageNumber for printed document

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
Sherif Abdeen
Guest





PostPosted: Mon Jan 16, 2006 3:26 pm    Post subject: Add PageNumber for printed document Reply with quote

Dear ,
I used the the TreePrintDocument object for printing my virtual tree data.
it is working fine, but there no page number and Page Title for the printed pages.
Is there a way to add these features to the printed pages?

Thanks & Best Regards
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Jan 17, 2006 7:47 am    Post subject: Reply with quote

To print page numbers and titles etc you will need to derive your own class from VirtualTreePrintDocument and override the OnPrintPage method. Call the base.OnPrintPage method first to print the standard information then add your own title and page numbers (you can use the CurrentPage property to get the current page number).

If you want to adjust the area that the base method prints the standard information to (to make room for your title) then you can override the GetAdjustedMarginsBounds method to return the area you want it to print to.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Sherif Abdeen
Guest





PostPosted: Wed Jan 18, 2006 8:45 am    Post subject: Add PageNumber for printed document Reply with quote

Dear,

I started to write code depeneding on your instructions as follows:

*********************************************
Public Class print_class
Inherits Infralution.Controls.VirtualTree.VirtualTreePrintDocument

Protected Overrides Sub OnPrintPage(ByVal e As System.Drawing.Printing.PrintPageEventArgs)

Dim pageno As Integer
Call MyBase.OnPrintPage(e)
pageno = MyBase.CurrentPage
End Sub

End Class
*************************************************

Could you help in complete this code to add the page number and tilte on the printed page


Thanks & Best Regards
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Jan 18, 2006 11:04 pm    Post subject: Reply with quote

Try something like:

Code:

Public Class print_class
    Inherits Infralution.Controls.VirtualTree.VirtualTreePrintDocument

    Protected Overrides Sub OnPrintPage(ByVal e As System.Drawing.Printing.PrintPageEventArgs)

        Call MyBase.OnPrintPage(e)

        Dim title as String = String.Format("My Title - Page No: {0}", CurrentPage)
         e.Graphics.DrawString(title, Tree.Font, Brushes.Black, e.MarginsBounds.Left, e.MarginBounds.Top - Tree.Font.Height)

    End Sub
End Class
 

_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
S
Guest





PostPosted: Sun Jan 22, 2006 9:29 am    Post subject: Reply with quote

Dear,

Thanks for your assistance. I am about to buy license very soon.

Is there a property to get the total number of printed pages?

Best Regards
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Jan 23, 2006 4:25 am    Post subject: Reply with quote

No this is a bit of a problem with .NET printing in general. To calculate the total number of printed pages you would have to first completely execute a print document - which will obviously double the printing time.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Feb 01, 2006 5:52 am    Post subject: Reply with quote

Version 2.4.0 of Virtual Tree has now been released. It includes support for printing headers and footers including page numbers.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group