Appendix I
Visual Basic Power Packs
When Visual Basic .NET first appeared, it was missing many features that developers had found extremely useful in Visual Basic 6. Power Packs were invented to provide objects and tools to fill the need for these missing features and to make programming easier and more productive in general.
This appendix describes Visual Basic Power Tools provided by Microsoft and other compatibility tools that you may find useful.
Originally Microsoft provided its Power Packs as a download but now they are included in Visual Basic. Near the bottom of the Toolbox, you should be able to find a section of tools named Visual Basic Power Packs that you can add to your forms. The following sections describe the Power Pack tools. You can learn more about the Power Packs at http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.powerpacks.aspx.
The DataRepeater control allows you to define a template of controls to display a piece of data. The repeater then repeats your template for each row in a data source and displays the result in a scrollable container.
The LineShape, OvalShape, and RectangleShape controls let you easily place lines, ovals, and rectangles on a form without using pens, brushes, and Graphics objects.
Properties let you set the controls’ pens and brushes at design time. The controls support events such as Click and DoubleClick, and many of the graphical methods provided in the System.Drawing namespace. The OvalShape and RectangleShape controls even support linear gradient brushes that let you add interesting graphical effects at design time.
In Visual Basic 6 and earlier versions, the Form control had a PrintForm method that sent an image of the form to the printer. The result was a bitmap image that usually looked grainy on the printout. It did not take full advantage of the printer’s high resolution, and it didn’t add extra data that might not fit on the monitor but that could fit on a printout.
Despite these drawbacks, PrintForm was extremely easy to use. The program simply called the form’s PrintForm method. This is much simpler than generating a high-resolution printout, so developers often used it to give early versions of an application a printing capability. For many applications, PrintForm was good enough, and it gave users a WYSIWYG (what you see is what you get) printing tool, so that’s all many programs needed.
Similarly the PrintForm component enables a Visual Basic .NET application to print a form’s image quickly and easily.
The GotDotNet Visual Basic Power Pack includes seven useful controls. Although they were written in Visual Basic 2003, they can still be useful. The Power Pack comes with source code so you can upgrade them to Visual Basic 2012 or use their code as a starting point for building your own controls.
The following list summarizes the seven controls:
Unfortunately, Microsoft closed the GotDotNet website in 2007. Before the site disappeared, however, I saved a copy of the Power Pack. You can get more information and download it at http://www.vb-helper.com/tip_gotdotnet_powerpack.html.
18.191.254.116