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.
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. |
* 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