How the hell do I simply print out the contents of a textbox? First I tried a simple:
Private Sub mnuMainFilePrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuMainFilePrint.Click
Select Case printPad.ShowDialog()
Case DialogResult.OK
printdocPad.Print()
End Select
End Sub
Private Sub printdocPad_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printdocPad.PrintPage
e.Graphics.DrawString(noteArray(activePad).txtmain.Text, noteArray(activePad).txtmain.font, System.Drawing.Brushes.Black, 0, 0)
End Sub
That wouldn't wrap text. So I figured out I needed to find the rectangle instead of just using points. I try this and still not wrapping and its printing if down and to the left, not right in the upper corner of the page:
Private Sub mnuMainFilePrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuMainFilePrint.Click
Select Case printPad.ShowDialog()
Case DialogResult.OK
printdocPad.Print()
End Select
End Sub
Private Sub printdocPad_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printdocPad.PrintPage
Dim layout_rect As RectangleF
layout_rect = New RectangleF(0, 0, printdocPad.PrinterSettings.DefaultPageSettings.PaperSize.Width , printdocPad.PrinterSettings.DefaultPageSettings.PaperSize.Height)
e.Graphics.DrawString(noteArray(activePad).txtmain.Text, noteArray(activePad).txtmain.font, System.Drawing.Brushes.Black, layout_rect)
End Sub
I am completely lost right now and can not find any documentation to help me along. Can someone tell me what I'm doing so wrong?
Sorry bout so many questions lately, it's just I'm really damn stressed with life and obviously am not thinking clearly.
Question
bangbang023 Veteran
How the hell do I simply print out the contents of a textbox? First I tried a simple:
That wouldn't wrap text. So I figured out I needed to find the rectangle instead of just using points. I try this and still not wrapping and its printing if down and to the left, not right in the upper corner of the page:
I am completely lost right now and can not find any documentation to help me along. Can someone tell me what I'm doing so wrong?
Sorry bout so many questions lately, it's just I'm really damn stressed with life and obviously am not thinking clearly.
Link to comment
Share on other sites
1 answer to this question
Recommended Posts