Some of the most interesting and fun parts of a programming language are its graphics elements. In general, graphics fall into two major categories: vector and bitmap. Vector graphics are images generated by graphics methods such as DrawLine and DrawEllipse. The drawing you create is based on mathematical descriptions of the various shapes. Bitmap graphics… [Continue Reading]
Drawing and Painting
Drawing with GDI+ (Drawing and Painting) – Visual Basic 2008
You have seen the basics of displaying images on your forms; now let’s move on to some real graphics operations, namely how to create your own graphics with the Framework. Windows graphics are based on a graphics engine, known as GDI. GDI, which stands for Graphics Design Interface, is a collection of classes that enable… [Continue Reading]
The Basic Drawing Objects (GDI+) in Visual Basic 2008
This is a good point to introduce some of the objects we’ll be using all the time when drawing. No matter what you draw or which drawing instrument you use, one or more of the objects discussed in this section will be required. The Graphics Object The Graphics object is the drawing surface — your… [Continue Reading]
Drawing Shapes (with GDI+) in Visual Basic 2008
Now that we’ve covered the auxiliary drawing objects, we can look at the drawing methods of the Graphics class. Before getting into the details of the drawing methods, however, let’s write a simple application that draws a couple of simple shapes on a form. First, we must create a Graphics object with the following statements:… [Continue Reading]
Drawing Methods (with GDI+) in Visual Basic 2008
The Framework provides several drawing methods, one for each basic shape. You can create much more elaborate shapes by combining the methods described in the following sections. All drawing methods have a few things in common. The first argument is always a Pen object, which will be used to render the shape on the Graphics… [Continue Reading]
Gradients (Linear Gradients, Path Gradients) in Visual Basic 2008
In this section, you’ll look at the tools for creating gradients. The techniques for gradients can get quite complicated, but I will limit the discussion to the types of gradients you’ll need for business or simple graphics applications. Linear Gradients Let’s start with linear gradients. Like all other gradients, they’re part of the System.Drawing class… [Continue Reading]
Clipping (drawing with GDI+) in Visual Basic 2008
Anyone who has used drawing or image-processing applications already knows that many of the application’s tools use masks. A mask is any shape that limits the area in which you can draw. If you want to place a star or heart on an image and print something in it, you create the shape in which… [Continue Reading]
Applying Transformations (scaling, translation, and rotation) in Visual Basic 2008
In computer graphics, there are three types of transformations: scaling, translation, and rotation: The scaling transformation changes the dimensions of a shape but not its basic form. If you scale an ellipse by 0.5, you’ll get another ellipse that’s half as wide and half as tall as the original one. The translation transformation moves a… [Continue Reading]