Line()

Syntax

Line(x, y, Width, Height [, Color])
Description
Draw a line of given dimensions on the current output. 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. The current output is set with StartDrawing().

Example:
  ; Several lines in random colors
  Width  = 220
  Height = 150
  If OpenWindow(0, 0, 0, Width, Height, #PB_Window_SystemMenu|#PB_Window_ScreenCentered, "Lines")
    If StartDrawing(WindowOutput())
      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 : EventID = WaitWindowEvent() : Until  EventID = #PB_Event_CloseWindow
  EndIf

Supported OS

All

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