JAL Computing

C++COMProgramming .NET Mac Palm CPP/CLI Hobbies

 

Home
Up

Chapter 24 "A Windows Form Print Framework"

To demonstrate the capabilities of inheritance and OOP here are a few screenshots of a WinForms Printing Framework using Visual Studio as a code generator. The printable controls are created by extending from existing controls in the System.Windows.Forms.Control namespace. The new user controls are then compiled into a dll and added to the Visual Studio Form Designer Toolbox. When you drag a printable control onto Visual Studio, the Form Designer does all of the heavy lifting, generating the code, calculating location and size, and setting properties. If you drag a printable control onto printable panel, the Form Designer provides the event mechanism to add the control to the panel! 

You can just drag the printable components onto the screen.

Here is a database aware Windows Form application in action. The repeating phone fields are shown in a data-bound datagrid.

Now you can print from the Print Preview Dialog. The printing framework extracts the necessary information from the printable components and draws to the printer using the graphics object. Printable components can support color.

You can also print text across multiple pages using a user selected page range.

Pretty cool!

Send mail to [email protected] with questions or comments about this web site. Copyright © 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 © 
Last modified: 08/04/09
Hosted by www.Geocities.ws

1