Help / WLanguage / WLanguage functions / Controls, pages and windows / Drawing functions
  • Drawing a polygon in an Image control
dPolygon (Example)
Drawing a polygon in an Image control
The following code is used to draw a 4-side polygon in an Image control (IMG_ImageDrawing). The coordinates of the polygon segments are entered by the user in edit controls (X1, Y1, X2, Y2, X3, Y3, X4, Y4). The background color and the side color are selected by the user via two radio buttons (RADIO_SelectBackground and RADIO_SelectLine).
// Declare the variables
BackgroundColor is int
LineColor is int
// Declare the drawing in the "IMG_ImageDrawing" control
// Retrieve the selected background color
SWITCH RADIO_SelectBackground
CASE 1: BackgroundColor = LightRed
CASE 2: BackgroundColor = LightBlue
CASE 3: BackgroundColor = LightGreen
CASE 4: BackgroundColor = LightYellow
// Retrieve the selected line color
CASE 1: LineColor = LightRed
CASE 2: LineColor = LightBlue
CASE 3: LineColor = LightGreen
CASE 4: LineColor = LightYellow
// Draw the polygon
dPolygon(4, X1, Y1, X2, Y2, X3, Y3, X4, Y4, BackgroundColor, LineColor)
Minimum version required
  • Version 9
This page is also available for…
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help