PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Drawing a text in an Image control: dynamic font
  • Drawing a text in an Image control
Drawing a text in an Image control: dynamic font
Windows Mobile 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 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 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 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