PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Modifying the color of an area
Modifying the color of an area
The following code is used to modify the color of an area in an image control (IMG_ImageDrawing). The user clicks the image control to select this area. The new color is selected by the user via a radio button (RADIO_SelectColor). The coordinates of the mouse click are retrieved by MouseXPos and MouseYPos.
In this example, we will assume that the image control (IMG_ImageDrawing) contains several drawings.
// -- Click code of "IMG_ImageDrawing"
// Declare the variables
AreaColor is int
XCoord is int
YCoord is int

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

// Retrieve the coordinates of the mouse click
XCoord = MouseXPos()
YCoord = MouseYPos()

// Retrieve the selected fill color
SWITCH RADIO_SelectColor
CASE 1: AreaColor = LightRed
CASE 2: AreaColor = LightBlue
CASE 3: AreaColor = LightGreen
CASE 4: AreaColor = LightYellow
END

// Color the area
dFill(XCoord, YCoord, AreaColor)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment