Category Archive for: Drawing with Visual Basic

Spirals Revised

The Spirals 1 application implements the technique just described. The Picture2 control is invisible and has its AutoRedraw property set to True, It also has the exact position and dimensions as the visible Picture! control. The revised Draw-Roulettel) routine, which draws on both controls, is shown next The Refresh method seems unnecessary, but the program won’t work without it.…

Read More →

Optimization Issues

If you experiment with Spiral application, you’ll see that it has a major flaw: if you .swltch to another application and then return to the Spiral window, the curve is erased. This isn’t really a problem with the application per se, rather, it’s a thorny issue in drawing with Visual Basic. You can overcome it in several ways,…

Read More →

T’he Draw First Function Button

The Draw Second Function button’s code is identical; only instead of calling the FunctionEvaIlO function, it calls the Function Eva120 function, which calculates adifferent function The actual graph of the function is shown in Figure 6.18. The problem with the code so far is that there are gaps between successive points of the function. To “close” these gaps,…

Read More →

Drawing Rubber Lines

The most common example of the XOR drawing moue is in drawing rubber lines. A rubber line is a line with one of its endpoints fixed on the screen and the other endpoint moving around, following the movement of the pointer. Using rubber lines, the user can verify the final position of a line (and practically every other shape)…

Read More →

VB6 at Work: The PieChart Project

The PieChart application uses the Circle method to draw pie charts with connected arcs, as shown in Figure 6.11. Because a connected arc is a closed shape, it can also be filled with a pattern or a solid color, as specified by the FillStyle and FillColor properties. The PieChart application lets you select whether the pie’s slices will be…

Read More →

Drawing Boxes

Visual Basic offers a convenient way to draw boxes: the B option (Box) of the Line methbd.1f you include this option, you can draw a box whose upper-left comer is defined by the first ‘coordinate pair and whose lower-right comer is defined by the second coordinate pair, The last four commands in the Step option example could be replaced…

Read More →

Graphics Methods

Now we can look atthe drawing methods of VISUalBasic, which are the following: . . • Print    Displays a string • Line     Draws lines and boxes • Circle   Draws circles and arcs • Point.   Retrieves the Color value of a point • PSel    Sets the color of a Point…

Read More →

SealeX, SealeY Methods”

On occasion, you’ll want to express the control’s new size in a given coordinate system without changing the container’s coordinate system. Let’s say the Form’s coordinate system is 1 (twips) and you want to place ‘a PictureBox on it with the exact dimensions (;f 1.20 x 2.00 inches. First, calculate how many twips correspond. to 1.20 and 2.00 inches,…

Read More →

Scale Properties and Methods

Now we can look at the properties. and methods that relate to the control’s position and the coordinate system. There are two groups of properties: those that control the size and position of the control and those that affect (and are affected by) the choice of coordinate system. Width and Height Properties These two properties determine the actual…

Read More →

Coordinate Systems

Visual Basic provides two basic methods for drawing shapes on controls and a method for displaying text: • Line Draws lines and boxes • Circle Draws circles and ellipses • Print Displa.ys text strings (A fourth method, Point, turns individual pixels on and off, and we’llexplore thismethod in the following chapter.) Before you dra w anything,…

Read More →

Back to Top