Gambas Documentation - /comp/gb.qt4/draw/line

# Draw.Line (gb.qt4)

Static Sub Line ( X1 As Integer, Y1 As Integer, X2 As Integer, Y2 As Integer )

Draws a line.

### Examples

    ' This example will draw a red line on the form. To try out this example,
    ' start a new graphics project and place a Button on the Form.

    PUBLIC SUB Button1_Click()
    Draw.Begin(ME)
    Draw.LineWidth = 20
    Draw.ForeColor = Color.Red
    Draw.Line(50, 100, 200, 150)
    Draw.End
    END

    ' This example will draw a 'X' in white color. To try out this example,
    ' start a new graphics project and place a Button on the Form.

    PUBLIC SUB Button1_Click()
    Draw.Begin(ME)
    Draw.LineWidth = 10
    Draw.ForeColor = &hFFFFFF
    Draw.Line(50, 50, 200, 200)
    Draw.Line(50, 200, 200, 50)
    Draw.End
    END

    ' This example will draw a pattern of alternating red and yellow
    ' lines on the form. To try out this example, start a new graphics
    ' project and place a Button on the Form.

    PUBLIC SUB Button1_Click()

    DIM i, Bottom AS Integer
    Bottom = ME.Height

    Draw.Begin(ME)
    Draw.LineWidth = 4

    FOR i = 0 TO Bottom STEP 8
    Draw.ForeColor = Color.Yellow
    Draw.Line(0, i, ME.Width, i)
    Draw.ForeColor = Color.Red
    Draw.Line(0, i + 4, ME.Width, i + 4)
    NEXT
    Draw.End

    END

}