defines the line type.
DefLine [style] [, thickness]
style, thickness:integer expression
DefLine defines the appearance of a line drawn using the Line, Box, RBox, Circle, Ellipse and Polyline commands.
The first parameter determines the appearance of the line as follows:
style = 0 or PS_SOLID | solid line |
style = 1 or PS_DASH | dashed line |
style = 2 or PS_DOT | dotted line |
style = 3 or PS_DASHDOT | dash-dot line |
style = 4 or PS_DASHDOTDOT | -..-..- line |
style = 5 or PS_NULL | invisible border |
style = 6 or PS_INSIDEFRAME | dithered, e.g., color emulation |
style = 7 or PS_USERSTYLE | an array with user defined styles. |
style = 8 or PS_ALTERNATE | each other pixel will be set, only useable with PS_COSMETIC |
style = 15 or PS_STYLE_MASK | can have one of the styles above |
style = 0 or PS_ENDCAP_ROUND | end of the line will be rounded |
style = 256 or PS_ENDCAP_SQUARE | end of the line will be square |
style = 512 or PS_ENDCAP_FLAT | end of the line is flat |
style = 3840 or PS_ENDCAP_MASK | can get one value of the three possible (0, 256, 512) |
style = 0 or PS_JOIN_ROUND | join is round |
style = 4096 or PS_JOIN_BEVEL | join is bevel |
style = 8192 or PS_JOIN_MITER | join is miter |
style = 0xF000 or PS_JOIN_MASK | can get one of the three possible values (0, 4096, 8192) |
style = 0 or PS_COSMETIC | fixed width and fixed height of a used line, very quick |
style = 0x10000 or PS_GEOMETRIC | scaleable line with fixed are variable style, and with the width of more as one pixel |
style = 0xF0000 or PS_TYPE_MASK | can contents PS_COSMETIC or PS_GEOMETRIC |
thickness specifies the line thickness in pixels.
Warning! When thickness is over 1, a solid line is always drawn.
Example 1
OpenW 1
Local a%, i%
Color RGB(0, 255, 0)
For i% = 0 To 4
DefLine i%, 1
Line 0, (i% + 1) * _Y / 6, _X, (i% + 1) * _Y / 6
Next
KeyGet a% // Press any key
For i% = 0 To 4
DefLine i%, i%
Line 0, (i% + 1) * _Y / 6, _X, (i% + 1) * _Y / 6
Next
Do : Sleep : Until Win_1 Is Nothing
Example 2
OpenW 1
Local i&, j&, stp&
DefLine PS_INSIDEFRAME, 99
stp& = 20
For i& = 0 To _X Step stp&
j& = i& * 255 / _X
RGBColor RGB(255 - j&, 0, j&)
PBox i&, 0, i& + stp& - 1, _Y
Next i&
Do : Sleep : Until Win_1 Is Nothing
DefLine internally uses the Windows function CreatePen(). The line color must be set beforehand with BkColor, Color, RGBColor, or QBColor.
{Created by Sjouke Hamstra; Last updated: 28/09/2014 by James Gaite}