OneToMany

Line

The Line control lets you draw lines wherever you want on a form, but it does appear strange at large widths. This is a full partner in the event loop, with its own properties, events and methods.

Property

Value

Purpose

BorderWidth

Numeric

The width of the line drawn, in pixels. Note that lines with a BorderWidth of 6 or more start to take on an oblong shape.

LineSlant

"\"

Line slants from the upper left to lower right corner.

"/"

Line slants from the upper right to lower left corner.


This control puts a line into a rectangle described by its Top, Left, Height and Width properties, and responds to the usual stimuli of MouseClicks and DragDrop events (including, starting in VFP 7, MouseEnter and MouseLeave). We doubt we'll use its events for much, however, because it is a pretty limited input device. It's not obvious by looking at Line's properties, but you create a horizontal line by setting its Height to 0 or a vertical line with Width of 0.

Don't assume the Width of a Line control is its actual width, nor that the control's Height is its real height. BorderWidth plays a tricky part here. Visual FoxPro attempts to create a line of width BorderWidth by drawing half the thickness above the line and half below, a reasonable algorithm. But this principle is taken too far, including the endpoints, creating a half-circle of one half of the BorderWidth around each. This is not only ugly, but inconsistent with other controls whose visual appearance is cropped at the rectangle described by their Top, Left, Height and Width properties.


So, the real "top" and "left" of a line control is its Top or Left minus one-half its BorderWidth, and its real "width" and "height" is its Width and Height plus BorderWidth.

Line events fire whenever the specified action (MouseOver, Click, whatever) occurs over the defining rectangle, not just over the line.


Example

* A simple line control on a form, showing the oblong shape. oForm = CREATEOBJECT("form") oForm.Show() oForm.AddObject("linMine", "Line") WITH oForm.LinMine   .Top = 30   .Left = 30   .BorderWidth = 20   .Height = 0   .Visible = .T. ENDWITH

See Also

BorderWidth, LineSlant


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