# CanvasDrawPoly

int CanvasDrawPoly (int panelHandle, int controlID,int numberOfPoints, Point points[], int wrap,int drawMode);

## Purpose

Draws a polygon on the canvas control by connecting the specified points.

CanvasDrawPoly draws the frame of the polygon using the current value of the following attributes:

ATTR_PEN_COLOR
ATTR_PEN_MODE
ATTR_PEN_WIDTH
ATTR_PEN_STYLE (ignored when pen width is greater than one)

CanvasDrawPoly draws the interior of the polygon using the current value of the following attributes:

ATTR_PEN_MODE
ATTR_PEN_PATTERN

## Parameters

Input
Name | Type | Description
panelHandle | integer | Specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
controlID | integer | The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl.
numberOfPoints | integer | Number of vertices in the polygon.
points | Point array | Array of Point structures specifying the locations of the vertices of the polygon. The Point structure is defined as follows: typedef struct { int x; int y; } Point; Example /* Declare and initialize an array of Points for the polygon: */ Point polyPoints[5] = { {40,10}, {70, 30}, {50, 50}, {20, 40}, {30, 25} }; CanvasDrawPoly(panelHandle, controlId, 5, polyPoints, 1 /* wrap */, VAL_DRAW_FRAME);
wrap | integer | Indicates whether to draw a line between last point and first point, thereby closing the polygon frame. If nonzero, the function closes the polygon frame. If zero, the function does not close the polygon frame. The function ignores the value when drawing only the interior.
drawMode | integer | Specifies whether to draw the polygon frame, or interior, or both. The following lists the valid values. VAL_DRAW_FRAME VAL_DRAW_INTERIOR VAL_DRAW_FRAME_AND_INTERIOR

## Return Value

Name | Type | Description
status | integer | Return value indicating whether the function was successful. A negative number indicates that an error occurred.
Code | Error Message String
xx | Success