BCX_POLYLINE function

Purpose: BCX_POLYLINE function connects the points in the specified array to draw a series of line segments


Syntax:

 RetVal% = BCX_POLYLINE(hWnd, _
                     pPointX, _
                  numPointX%  _
                      [, Pen] _
                  [, DrawHDC])

Parameters:

  • hWnd Identifies the window where drawing takes place.
  • pPointX Pointer to an array of POINT structures that specify the startpoint and the endpoints of the line segments.
  • numPointX% Specifies the number of points in the array. This value must be greater than or equal to 2.
  • Pen [OPTIONAL] integer representing the RGB color code. The default is 0 which is a black pen.
  • DrawHDC [OPTIONAL] HDC (Handle to Device Context) pointing to an already open HDC. This is useful if a device context is to be written to many times. In this case the programmer is responsible for closing the HDC at the appropriate time.

Return Value:

  • RetVal% is a nonzero integer if the function succeeds, zero if the function fails.

Here is an example of the BCX_POLYLINE function.


 GUI "BCX_POLYLINE"
 
 DIM pPoints[16] AS POINT
 
 SUB FORMLOAD
   GLOBAL Form1 AS HWND
 
   Form1 = BCX_FORM("BCX_Polyline", 0, 0, 135, 110)
   BCX_SET_FORM_COLOR(Form1,QBCOLOR(31))
   CENTER(Form1)
   SHOW(Form1)
 END SUB
 
 BEGIN EVENTS
   SELECT CASE CBMSG
     CASE WM_PAINT
     CALL DrawStuff
 
     CASE WM_CLOSE
     DestroyWindow(Form1)
     EXIT FUNCTION
 
   END SELECT
 END EVENTS
 
 SUB DrawStuff
   DIM RAW RetVal%
   pPoints[0].x = 46: pPoints[0].y = 83
   pPoints[1].x = 86: pPoints[1].y = 83
   pPoints[2].x = 100: pPoints[2].y = 94
   pPoints[3].x = 93: pPoints[3].y = 112
   pPoints[4].x = 83: pPoints[4].y = 116
   pPoints[5].x = 35: pPoints[5].y = 116
   pPoints[6].x = 83: pPoints[6].y = 116
   pPoints[7].x = 90: pPoints[7].y = 123
   pPoints[8].x = 82: pPoints[8].y = 135
   pPoints[9].x = 70: pPoints[9].y = 142
   pPoints[10].x = 26: pPoints[10].y = 142
   pPoints[11].x = 46: pPoints[11].y = 83
   pPoints[12].x = 51: pPoints[12].y = 83
   pPoints[13].x = 30: pPoints[13].y = 142
   pPoints[14].x = 33: pPoints[14].y = 142
   pPoints[15].x = 53: pPoints[15].y = 83
   RetVal% = BCX_POLYLINE(Form1, pPoints, 16, QBCOLOR(12))
   pPoints[0].x = 165: pPoints[0].y = 95
   pPoints[1].x = 151: pPoints[1].y = 83
   pPoints[2].x = 126: pPoints[2].y = 83
   pPoints[3].x = 103: pPoints[3].y = 103
   pPoints[4].x = 96: pPoints[4].y = 125
   pPoints[5].x = 111: pPoints[5].y = 142
   pPoints[6].x = 134: pPoints[6].y = 142
   pPoints[7].x = 156: pPoints[7].y = 125
   RetVal% = BCX_POLYLINE(Form1, pPoints, 8, QBCOLOR(9))
   pPoints[0].x = 168: pPoints[0].y = 83
   pPoints[1].x = 202: pPoints[1].y = 83
   pPoints[2].x = 207: pPoints[2].y = 100
   pPoints[3].x = 230: pPoints[3].y = 83
   pPoints[4].x = 234: pPoints[4].y = 85
   pPoints[5].x = 209: pPoints[5].y = 108
   pPoints[6].x = 220: pPoints[6].y = 142
   pPoints[7].x = 184: pPoints[7].y = 142
   pPoints[8].x = 179: pPoints[8].y = 120
   pPoints[9].x = 153: pPoints[9].y = 143
   pPoints[10].x = 150: pPoints[10].y = 139
   pPoints[11].x = 177: pPoints[11].y = 114
   pPoints[12].x = 168: pPoints[12].y = 83
   RetVal% = BCX_POLYLINE(Form1, pPoints, 13, QBCOLOR(13))
 END SUB