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.

MICROSOFT POWER PACKS

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.

DataRepeater

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.

Line and Shape Controls

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.

PrintForm Component

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.


CAPTURE OR PRINT
You can also use the Form object’s DrawToBitmap method to capture an image of the form in a bitmap. You can then print the image, display a print preview, save it into a file, or do anything else that you can do with a bitmap. For an example, see http://www.vb-helper.com/howto_2005_drawtobitmap.html. That example was written in Visual Basic 2005 but works in later versions, too.

GOTDOTNET POWER PACK

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:

  • BlendPanel — Provides a background with linear gradient shading. Note that the WPF LinearGradientBrush class provides a similar, but more flexible, effect. Other WPF classes such as RadialGradientBrush provide even more shading features.
  • UtilityToolbar — A toolbar that has a look and feel similar to the Microsoft Internet Explorer toolbar.
  • ImageButton — A button with a transparent background. You can use it, for example, to display a round button over a gradient shaded, or complex, background, without messing up the background.
  • NotificationWindow — Displays text and graphics in a pop-up notification window.
  • TaskPane — A container that provides collapsible panes similar to the WPF Expander control.
  • FolderViewer — Displays a hierarchical view of a directory tree.
  • FileViewer — Displays a list of the files in a directory.

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.254.116