ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Drawing functions
  • Drawing text in an Image control: dynamic font
  • Drawing text in an Image control
Drawing text in an Image control: dynamic font
WINDEVWEBDEV - Server codeReports and QueriesWindowsUser code (UMC)PHPAjax The following code draws text in an Image control (IMG_ImageDrawing). The text to draw is entered by the user in an Edit control (EDT_EditText). The font is selected by the user with FontSelect.
// Create a default font
DefaultF is Font = FontCreate("Arial", 12)
// Use a variable to store the user font
UserF is Font
// Ask the user to modify his font
FontSelect(UserF, True, DefaultF)
// Initialize the font
dFont(UserF)
// Draw the text
dText(10, 10, EDT_EditText)
Drawing text in an Image control
The following code draws text in an Image control (IMG_ImageDrawing). The text to draw is entered by the user in an Edit control (EDT_EditText). The font and the size of the text are selected by the user via two radio buttons (RADIO_SelectFont and RADIO_SelectSize).
// Declare the variables
TextFont is string
TextSize 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
 
// Initialize the font
dFont(TextFont, TextSize)
// Draw the text
dText(10, 10, EDT_EditText)
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