ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Drawing functions
  • Changing the color of an area
Changing the color of an area
The following code changes the color of an area in an Image control (IMG_ImageDrawing). The user clicks the Image control to select the area. The new color is selected by the user via a radio button (RADIO_SelectColor). The coordinates of the mouse click can be retrieved with 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

Last update: 05/26/2022

Send a report | Local help