ADD OBJECT

Box, Circle, Line, Cls

These form methods let you draw rectangles, circles and ellipses, and lines on forms, and then get rid of them.

Usage

frmForm.Box( [ nLeft, nTop, ] nRight, nBottom ) frmForm.Circle( nRadius [, nCenterX, nCenterY                  [, nAspectRatio ] ] ) frmForm.Line( [ nLeft, nTop, ] nRight, nBottom )
The position and radius are measured in the form's ScaleMode. If you omit nLeft and nTop for a Box or Line, the current position of the cursor indicated by the CurrentX and CurrentY properties is used. This makes sense, though we think it's kind of odd to have the first two parameters be optional. Similarly, if the center point of the circle is omitted, CurrentX and CurrentY are used.

nAspectRatio determines whether Circle draws a circle or an ellipse. The aspect ratio is the ratio of the vertical "radius" to the horizontal "radius." A value of 1 gives a circle. Larger values of nAspectRatio lead to an ellipse that is taller than it is wide. Smaller values of nAspectRatio give an ellipse wider than it is tall.

Circle does weird things with negative aspect ratios. For absolute values up to 1, negative and positive aspect ratios give the same results. But, with an absolute value greater than 1, a negative aspect ratio results in an ellipse larger than one with the same positive aspect ratio. Frankly, the whole thing smells like a bug. Circle shouldn't even accept a negative aspect ratio.


These items are drawn in the form's ForeColor and respect the settings of DrawMode, DrawStyle, DrawWidth, FillColor and FillStyle.

Shapes created in this way are different than those created with the Shape control. These are just images on the form, like the @ SAY commands of years gone by. They don't have properties, events or methods. In addition, while the shapes are initially drawn on top of any controls, they can fall behind other objects when the display is refreshed or that control gets focus.

Example

ThisForm.Box(50, 50, 100, 100) ThisForm.Circle(25, 100, 100) ThisForm.Circle(40, 20, 70, .5) ThisForm.Line(100, 200)

Usage

frmForm.CLS()
The CLS (for "CLear Screen") method clears away the stuff you draw with Box, Circle, Line, Print and PSet. It doesn't affect actual controls.

Don't confuse CLS with either the CLEAR command (which visually removes everything from a window, controls and all—the controls come back if you land on them) or the Clear method, which is used with list boxes and combo boxes.

See Also

@...Box, @...Say, @...To, Clear, Clear Method, CurrentX, CurrentY, DrawMode, DrawStyle, DrawWidth, FillColor, FillStyle, ForeColor, Print, PSet, ScaleMode, Shape


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net