CanvasDrawPoly
- Updated2023-02-21
- 2 minute(s) read
int CanvasDrawPoly (int panelHandle, int controlID, size_t 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
Supported Controls
You can use CanvasDrawPoly with canvas controls.
Parameters
Input | ||
Name | Type | Description |
panelHandle | int | Specifier for a particular panel that is currently in memory. You can obtain this handle from functions such as LoadPanel and NewPanel. |
controlID | int | 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 functions such as NewCtrl and DuplicateCtrl. |
numberOfPoints | size_t | Number of vertices in the polygon. |
points | Point [] | 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: */ |
wrap | int | Indicates whether to draw a line between last point and first point, thereby closing the polygon frame. Specify a nonzero value or select Yes in the function panel to close the polygon frame. Specify 0 or select No in the function panel if you do not want to close the polygon frame. The function ignores the value when drawing only the interior. |
drawMode | int | 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 | int | Return value indicating whether the function was successful. A negative number indicates that an error occurred. |
Additional Information
Library: User Interface Library
Include file: userint.h
LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later
Example
Refer to userint\canvas.cws for an example of using the CanvasDrawPoly function.