in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

Draw horizontal line inf footer while using PrintableComponentLink and PageHeaderFooter

Last post 11/12/2008 6:33 AM by Filip Willems. 4 replies.
Page 1 of 1 (5 items)
Sort Posts:
Previous Next
  • 11/6/2008 5:44 AM

    Draw horizontal line inf footer while using PrintableComponentLink and PageHeaderFooter

     I have a button on a form, when I click it I build a preview like this, where I want to add a horizontal line on top of the footer

        Private Sub btnReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReport.Click
            Dim ps As New PrintingSystem
            Dim link As New PrintableComponentLink(ps)
            Dim FtMiddleColumn As String = "Page [Page # of Pages #] Pages"
            ' Create a PageHeaderFooter object and initializing it with the link's PageHeaderFooter.
            Dim Phf As PageHeaderFooter = link.PageHeaderFooter

            link.Component = Me.xgd
            link.EnablePageDialog = True

            ' Clear the PageHeaderFooter's contents.
            Phf.Footer.Content.Clear()
            ' Add custom information to the link's header/footer
            With Phf.Footer

    '*** I want to add a horizontal line here........

                .Content.AddRange(New String() {"", FtMiddleColumn, ""})
                .Font = New Font(Phf.Header.Font, FontStyle.Bold)
            End With

            link.CreateDocument()
            ps.PreviewFormEx.ShowDialog(Me)

    End Sub

    Blue skies, soft landings,
    Phil
  • 11/6/2008 7:20 AM In reply to

    Re: Draw horizontal line inf footer while using PrintableComponentLink and PageHeaderFooter

    Hello,

    Try the following code:


    Dim ps As PrintingSystem
    Dim WithEvents link As PrintableComponentLink

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button1.Click

        ps = New PrintingSystem
        link = New PrintableComponentLink(ps)
        Dim FtMiddleColumn As String = "Page [Page # of Pages #] Pages"
        ' Create a PageHeaderFooter object and initializing it with the link's PageHeaderFooter.
        Dim Phf As PageHeaderFooter = link.PageHeaderFooter

        link.Component = Me.xgd
        link.EnablePageDialog = True

        ' Clear the PageHeaderFooter's contents.
        Phf.Footer.Content.Clear()
        ' Add custom information to the link's header/footer
        With Phf.Footer
            .Content.AddRange(New String() {"", FtMiddleColumn, ""})
            .Font = New Font(Phf.Header.Font, FontStyle.Bold)
        End With

        link.CreateDocument()
        ps.PreviewFormEx.ShowDialog(Me)

    End Sub

    Private Sub CreateMarginalFooterArea(ByVal sender As Object, ByVal e As CreateAreaEventArgs) _
    Handles link.CreateMarginalFooterArea

        Dim gr As BrickGraphics = e.Graph

        Dim brick As LineBrick = gr.DrawLine(New PointF(0, 0), _
            New PointF(link.PrintingSystem.PageSettings.UsablePageSize.Width, 0), Color.Black, 2)

        brick.BorderWidth = 0
    End Sub

     

    BTW, it seems to me that you've got confused by the user name and the password fields when registering at this forum Geeked

    R&D, .NET Team.

    PS. If you wish to receive direct assistance from our Support Team, use Support Center at http://www.devexpress.com/sc.
  • 11/6/2008 7:39 AM In reply to

    Re: Draw horizontal line inf footer while using PrintableComponentLink and PageHeaderFooter

    Wow, this is excellent, thanks !

    BTW : I think one can use this in the header too at the bottom of the header, which parameters should be different then to draw the line "beneath" the headertext please ?

    BTW2 : I use a common, short, username on all forums, this makes it easy. It is related and to pay tribute to the WW2 Airborne unit the 463rd Parachute Field Artillery (part (attached) of the 101st Airborne Division since Bastogne), and FIWI are my initials Idea

    Blue skies, soft landings,
    Phil
  • 11/6/2008 9:36 AM In reply to

    Re: Draw horizontal line inf footer while using PrintableComponentLink and PageHeaderFooter

    Great! Glad to hear that this helps you Smile

    1) Well, then you can simply use the CreateMarginalHeaderArea event.

    2) Sorry to disappoint you, but there is a rule for our forums stating that users should use their real names (http://www.devexpress.com/Support/Forums.xml). This allows us to contact you directly when it is required to provide you with additional or private information which cannot be posted here.

    R&D, .NET Team.

    PS. If you wish to receive direct assistance from our Support Team, use Support Center at http://www.devexpress.com/sc.
  • 11/12/2008 6:33 AM In reply to

    Re: Draw horizontal line inf footer while using PrintableComponentLink and PageHeaderFooter

    Thanks again !

    1. works fine, I had to change the Y parameter to 14 to get the line beneath the headertext, but this was ok. Maybe there is a better way to get the line at the bottom of the header area, but it's working this way too...

     

     

     

    Dim brick As LineBrick = gr.DrawLine(New PointF(0, 14), new PointF(link.PrintingSystem.PageSettings.UsablePageSize.Width, 14), Color.Black, 1)

     

    2. No problem, I can understand that, changes were already made.

    Blue skies, soft landings,
    Phil
Page 1 of 1 (5 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED