Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
These form methods let you draw rectangles, circles and ellipses, and lines on forms, and then get rid of them.
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.
ThisForm.Box(50, 50, 100, 100)
ThisForm.Circle(25, 100, 100)
ThisForm.Circle(40, 20, 70, .5)
ThisForm.Line(100, 200)
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.
@…Box, @…Say, @…To, Clear, Clear Method, CurrentX, CurrentY, DrawMode, DrawStyle, DrawWidth, FillColor, FillStyle, ForeColor, Print, PSet, ScaleMode, Shape