Two Ways of Drawing

Visual Basic provides excellent support for vector graphics, but drawing lines, circles, and dots isn’t necessarily the best way of doing graphics under Windows. If you want complex images, you can usually get them faster by drawing the shape with a bitmap editor or a drawing program and plunking the result onto the screen.

This is particularly true when you get beyond two-dimensional shapes. If you really know your geometry, you can calculate three-dimensional coordinates and rotate them in space. For a shape of any complexity, the calculation takes seconds for wire-frame images. This might impress your engineer friends, but ordinary users will want shaded images instantly. If it can be done in cartoons and movies, why can’t you do it in your program? Well, you can, but you might not be willing to wait.

Drawing is one area where p-code can really drag you down. Fortunately, Visual Basic’s compiler now gives you a good shot at fast vector graphics comparable to what you could get from a C++ DLL. Nevertheless, my advice on vector graphics is to keep them short and simple. Remember that whatever you draw must be redrawn any time you resize the window, so think twice before making your graphics forms resizable. Setting the AutoRedraw property simply means that Windows will redraw instead of you.