B
Bill
Hi
I am trying to get my listbox items to print if they stream past the one
page mark. my code is working for one page of information (if the
e.hasmorepages) is not there.
But I am having trouble getting it to print on multiple pages. The second
page will not print at all.
Thanks in advance
Bill
'-----------------------------------------------------------------
Private Sub PrintDocCalc_PrintPage(ByVal sender As System.Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocCalc.PrintPage
'-----------------------------------------------------------------
Dim lpp As Single
Dim yPos As Single
Dim LeftMargin As Single = e.MarginBounds.Left
Dim TopMargin As Single = e.MarginBounds.Top
Dim line As String
Dim printFont As Font
printFont = New Font("Courier New", 10)
lpp = e.MarginBounds.Height / printFont.GetHeight(e.Graphics)
While (count < lpp And count < NumofLines)
yPos = TopMargin + (count * printFont.GetHeight(e.Graphics))
e.Graphics.DrawString(lstAddTape.Items(count), printFont, Brushes.Black,
LeftMargin, yPos)
count = count + 1
End While
If (count < NumofLines) Then
e.HasMorePages = True
PrintDocCalc.Print()
Else
e.HasMorePages = False
End If
End sub
I am trying to get my listbox items to print if they stream past the one
page mark. my code is working for one page of information (if the
e.hasmorepages) is not there.
But I am having trouble getting it to print on multiple pages. The second
page will not print at all.
Thanks in advance
Bill
'-----------------------------------------------------------------
Private Sub PrintDocCalc_PrintPage(ByVal sender As System.Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocCalc.PrintPage
'-----------------------------------------------------------------
Dim lpp As Single
Dim yPos As Single
Dim LeftMargin As Single = e.MarginBounds.Left
Dim TopMargin As Single = e.MarginBounds.Top
Dim line As String
Dim printFont As Font
printFont = New Font("Courier New", 10)
lpp = e.MarginBounds.Height / printFont.GetHeight(e.Graphics)
While (count < lpp And count < NumofLines)
yPos = TopMargin + (count * printFont.GetHeight(e.Graphics))
e.Graphics.DrawString(lstAddTape.Items(count), printFont, Brushes.Black,
LeftMargin, yPos)
count = count + 1
End While
If (count < NumofLines) Then
e.HasMorePages = True
PrintDocCalc.Print()
Else
e.HasMorePages = False
End If
End sub