Worked example : Turning a simple form into a printed page

The following is an example of the simplest scenario - a single form that we want to turn into a single page document. This is a form with a full size rich text box control which allows us to implement a rudimentary text editor.

The first step is to add a reference to the form print helper component project to the solution that has this editor form in it (see Video)

Then select the rich text box in the form editor. You will notice that a number of additional properties appear in the property grid for that control that pertain to how and where it will be printed. Set the RichTextBoxPrintMethod property to PrintAsRichText (see Video)

Position the rich text box control on the printed page by setting the BoundingRectangle property (see Video )

Wire up the print and print preview menu items to the Print and Print Preview methods:

Private Sub PrintPreviewToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PrintPreviewToolStripMenuItem.Click
End Sub

Private Sub PrintToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem.Click
End Sub

Last edited May 7, 2008 at 7:54 PM by Merrion, version 4


No comments yet.