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, 110, 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 = 26: pPoints[0].y = 83
     pPoints[1].x = 66: pPoints[1].y = 83
     pPoints[2].x = 80: pPoints[2].y = 94
     pPoints[3].x = 73: pPoints[3].y = 112
     pPoints[4].x = 63: pPoints[4].y = 116
     pPoints[5].x = 15: pPoints[5].y = 116
     pPoints[6].x = 63: pPoints[6].y = 116
     pPoints[7].x = 70: pPoints[7].y = 123
     pPoints[8].x = 62: pPoints[8].y = 135
     pPoints[9].x = 50: pPoints[9].y = 142
     pPoints[10].x = 6: pPoints[10].y = 142
     pPoints[11].x = 26: pPoints[11].y = 83
     pPoints[12].x = 31: pPoints[12].y = 83
     pPoints[13].x = 10: pPoints[13].y = 142
     pPoints[14].x = 13: pPoints[14].y = 142
     pPoints[15].x = 33: pPoints[15].y = 83
 RetVal% = BCX_POLYLINE(Form1, pPoints, 16, QBCOLOR(12))
     pPoints[0].x = 145: pPoints[0].y = 95
     pPoints[1].x = 131: pPoints[1].y = 83
     pPoints[2].x = 106: pPoints[2].y = 83
     pPoints[3].x = 83: pPoints[3].y = 103
     pPoints[4].x = 76: pPoints[4].y = 125
     pPoints[5].x = 91: pPoints[5].y = 142
     pPoints[6].x = 114: pPoints[6].y = 142
     pPoints[7].x = 136: pPoints[7].y = 125
 RetVal% = BCX_POLYLINE(Form1, pPoints, 8, QBCOLOR(9))
     pPoints[0].x = 148: pPoints[0].y = 83
     pPoints[1].x = 182: pPoints[1].y = 83
     pPoints[2].x = 187: pPoints[2].y = 100
     pPoints[3].x = 210: pPoints[3].y = 83
     pPoints[4].x = 214: pPoints[4].y = 85
     pPoints[5].x = 189: pPoints[5].y = 108
     pPoints[6].x = 200: pPoints[6].y = 142
     pPoints[7].x = 164: pPoints[7].y = 142
     pPoints[8].x = 159: pPoints[8].y = 120
     pPoints[9].x = 133: pPoints[9].y = 143
     pPoints[10].x = 130: pPoints[10].y = 139
     pPoints[11].x = 157: pPoints[11].y = 114
     pPoints[12].x = 148: pPoints[12].y = 83
 RetVal% = BCX_POLYLINE(Form1, pPoints, 13, QBCOLOR(13))
 END SUB