A device context is the way Windows represents certain display objects. In Visual Basic, only forms, Picture Box controls, and the printers have a device context, which means this technique is limited to displaying 3-D text on those objects.

The technique used here to display 3-D text is to output the string repeatedly at slightly different, overlapping locations. By varying the colour of the text with each iteration, you obtain a 3-D effect. Here's an example:

You can see that the text is output 128 times. Each time, the position shifts down slightly and to the right, and the colour changes. In the entire process, the colour changes from black or RGB(0, 0, 0) to essentially white or RGB(254, 254, 254). You could get a different but equally effective result by varying the colour from white to black by changing this single line of code:

Code: VB

.ForeColor = RGB(256 - i * 2, 256 - i * 2, 256 - i * 2)

This code varies the colour from blue to red:

Code: VB

.ForeColor = RGB(i * 2, 0, 256 - i * 2)

There are lots of attractive effects available with this technique. Its recommended that you experiment until you get just what you want.