PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Drawing a text in an Image control
Drawing a text in an Image control
The following code is used to draw a text in an Image control (IMG_ImageDrawing). The text to draw is entered by the user in an edit control (EDT_EditText). The font, the size and the color given to the text are selected by the user via three radio buttons (RADIO_SelectFont, RADIO_SelectSize and RADIO_SelectColor).
// Declare the variables
TextFont is string
TextSize is int
TextColor is int
// Declare the drawing in the "IMG_ImageDrawing" control
dStartDrawing(IMG_ImageDrawing)
// Retrieve the selected font
SWITCH RADIO_SelectFont
CASE 1: TextFont = "Arial"
CASE 2: TextFont = "Times New Roman"
CASE 3: TextFont = "Courier New"
END
// Retrieve the selected size
SWITCH RADIO_SelectSize
CASE 1: TextSize = 10
CASE 2: TextSize = 12
CASE 3: TextSize = 14
END
// Retrieve the color of the selected text
SWITCH RADIO_SelectColor
CASE 1: TextColor = LightRed
CASE 2: TextColor = LightBlue
CASE 3: TextColor = LightGreen
CASE 4: TextColor = LightYellow
END
// Initialize the font
dFont(TextFont, TextSize)
// Draw the text
dText(10, 10, EDT_EditText, TextColor)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment