Results 1 to 3 of 3

Thread: *resolved* "Right way" to print two-column documents?

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518

    *resolved* "Right way" to print two-column documents?

    I've been working on trying to print stuff in a two-column format recently. I'd really like to print two columns with different non-fixed contents. Based on printing with this code:
    Code:
        Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, _
        ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
            Dim iChars As Integer
            Dim iLines As Integer
            Dim strForPage As String
            Dim fmtStringFormat As New StringFormat()
    
            Dim iTabStops() As Single = {50, 50, 50, 50}
            fmtStringFormat.SetTabStops(0, iTabStops)
    
            Dim rectDraw As New RectangleF( _
                e.MarginBounds.Left, e.MarginBounds.Top, _
                e.MarginBounds.Width, e.MarginBounds.Height)
            Dim sizeMeasure As New SizeF(e.MarginBounds.Width, _
                e.MarginBounds.Height - PrintFont.GetHeight(e.Graphics))
    
            fmtStringFormat.Trimming = StringTrimming.Word
            e.Graphics.MeasureString(StringToPrint, PrintFont, sizeMeasure, _
                fmtStringFormat, iChars, iLines)
    
            strForPage = StringToPrint.Substring(0, iChars)
            e.Graphics.DrawString(strForPage, PrintFont, Brushes.Black, rectDraw, fmtStringFormat)
    
            If iChars < StringToPrint.Length Then
                StringToPrint = StringToPrint.Substring(iChars)
                e.HasMorePages = True
            Else
                e.HasMorePages = False
                StringToPrint = rtxtPrintBox.Text
            End If
        End Sub
    ...it seems to me that I could declare two rectangles instead of just one (rectDraw above) and print both? And then I would just have to be careful with the iChars < StringToPrint.Length part? If so then it seems to me that this would be pretty easy? Am I barking up the wrong tree or will this work?
    Last edited by Slow_Learner; Oct 8th, 2002 at 05:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width