Graphics Handling File Handling Immediate Solutions: Using the Graphics Class Using the Pen Class Specifying Drawing Colors Drawing Figures with Pens Repainting Windows Using Brush Classes Filling Figures with Brushes Using the Pens and Brushes Classes Handling Images Using the FileStream Class Using the FileMode Enumeration Using the FileAccess Enumeration Using the FileShare Enumeration Opening or Creating a File with the FileStream Class Using the StreamWriter Class Writing Text with the StreamWriter Class Using the StreamReader Class Reading Text with the StreamReader Class Using the BinaryWriter Class Writing Binary Data with the BinaryWriter Class Using the BinaryReader Class Reading Binary Data with the BinaryReader Class Using the File Class Using the Directory class Putting the File and Directory Classes to Work
In this chapter, we're going to take a look at two popular topics: graphics handling and file handling, both of which have changed since VB6. In VB6 and before, for example, graphics support was spread throughout, and you could use the graphics methods of forms and picture boxes as needed. Now, as with Java, the graphics capability has been lumped together into huge classes, primarily the Graphics class. Among other things, this means that the cherished AutoRedraw property of forms, which made forms redraw themselves if needed (as when they're uncovered or restored from being minimized) has been stripped out of Visual Basic entirely. This in turn means that redrawing forms is all up to you again (see "Repainting Windows" in this chapter). And, also as with Java, file handling is now based on streams in Visual Basic, and is handled with various stream classes. Streams refer to "streams" of data, which may be redirected in various ways. Although Java uses streams, they're probably not going to make life easier for the programmer trying to upgrade to VB .NET from VB6 who already has a lot to contend with, especially as all the old file handling support has been taken out of Visual Basic now.