Help / WLanguage / WLanguage functions / Controls, pages and windows / Drawing functions
  • Drawing a circle point by point
Drawing a circle point by point
The following code is used to draw a circle made of several points in an Image control (IMG_ImageDrawing). The coordinates of the center and the radius are entered by the user in edit controls (EDT_PosCenterH, EDT_PosCenterV and EDT_Radius). The color of the center point and the color of the circle are selected by the end user via two radio buttons (RADIO_SelectPointColor and RADIO_SelectCircleColor).
// Declare the variables
PointColor is int
CircleColor is int
Index is int
X, Y are int
// Declare the drawing in the "IMG_ImageDrawing" control
// Retrieve the color of the center point
SWITCH RADIO_SelectPointColor
CASE 1: PointColor = LightRed
CASE 2: PointColor = LightBlue
CASE 3: PointColor = LightGreen
CASE 4: PointColor = LightYellow
// Retrieve the color of the circle
SWITCH RADIO_SelectCircleColor
CASE 1: CircleColor = LightRed
CASE 2: CircleColor = LightBlue
CASE 3: CircleColor = LightGreen
CASE 4: CircleColor = LightYellow
// Draw the circle
FOR Subscript = 0 TO 360
 X = EDT_PosCenterH + EDT_Radius * Cos(Subscript)
 Y = EDT_PosCenterV + EDT_Radius * Sin(Subscript)
 dPoint(X, Y, CircleColor)
// Draw the center point
dPoint(EDT_PosCenterH, EDT_PosCenterV, PointColor)
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