|
|
|
|
|
- Drawing text in an Image control
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, size and color of 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)
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|