Line()

Syntax

Line(x, y, Width, Height [, Color])
Description
Draw a line of given dimensions on the current output. The current output is set with StartDrawing().

If the 'Color' parameter is not specified, the default color set with FrontColor() will be used. RGB() can be used to get a valid color value. A color table with common colors is available here.

Example:
  ; Several lines in random colors
  Width  = 220
  Height = 150
  If OpenWindow(0, 0, 0, Width, Height, "Lines", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If StartDrawing(WindowOutput(0))
      yStart = 0
      yEnd   = Height-yStart
      xStart = 10
      For xEnd=xStart To Width-xStart Step 1
        Line(xStart, yStart, xEnd, yEnd ,RGB(Random(255),Random(255),Random(255))) 
      Next
      StopDrawing() ; This is absolutely needed when the drawing operations are finished !!! Never forget it !
    EndIf
    
    Repeat : Event = WaitWindowEvent() : Until  Event = #PB_Event_CloseWindow
  EndIf

Supported OS

All

<- FrontColor() - 2DDrawing Index - LineXY() ->