PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Drawing a line in an Image control
dBackground (Example)
Drawing a line in an Image control
The following code is used to draw several drawings (a circle and a rectangle) with the same background color. The drawings will be created in an Image control (IMG_ImageDrawing). The color, the style and the type of hatching are selected by the user via three radio buttons (RADIO_SelectBackground, RADIO_SelectStyle and RADIO_SelectHatch).
WINDEV Mobile In this version, you cannot hatch the background of a drawing. The third option of the "RADIO_SelectStyle" radio button and the "RADIO_SelectHatch" radio button are not available.
// Declare the variables
BackgroundColor is int
BackgroundStyle is int
BackgroundHatch is int

// Declare the drawing in the "IMG_ImageDrawing" control
dStartDrawing(IMG_ImageDrawing)

// Retrieve the selected background color
SWITCH RADIO_SelectBackground
CASE 1: BackgroundColor = LightRed
CASE 2: BackgroundColor = LightBlue
CASE 3: BackgroundColor = LightGreen
CASE 4: BackgroundColor = LightYellow
END

// Retrieve the selected background style
SWITCH RADIO_SelectStyle
CASE 1: BackgroundStyle = 0
CASE 2: BackgroundStyle = 1
CASE 3: BackgroundStyle = 2
END

// Retrieve the selected type of hatching for the background
SWITCH RADIO_SelectHatch
CASE 1: BackgroundHatch = 0
CASE 2: BackgroundHatch = 1
CASE 3: BackgroundHatch = 2
CASE 4: BackgroundHatch = 3
CASE 5: BackgroundHatch = 4
CASE 6: BackgroundHatch = 5
END

// Initialize the background of the drawings
dBackGround(BackgroundColor, BackgroundStyle, BackgroundHatch)

// Draw the circle
dCircle(10, 10, 50, 50)

// Draw the rectangle
dRectangle(40, 40, 80, 80)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment