This function draws text in a rectangle specified in the designated object (the screen, printer, or image data).

[C++Builder]     BOOL IKDrawText(LPVOID DeviceValue, LPRECT PrintRect, PTR_IKPRINT_TEXTINFO TextInfo, LPCSTR Text, BOOL EnableFontScale, BOOL Clip, BYTE DeviceMode);
[Delphi]         function IKDrawText(DeviceValue: THandle; var PrintRect: TRect; var TextInfo: IKPRINT_TEXTINFO; Text: PChar; EnableFontScale, Clip: LongBool; DeviceMode: Byte): LongBool;

Parameters

Name Explanation
DeviceValue The device context or the raster image data (depending on the DeviceMode)
PrintRect Structure containing the coordinates of points for the rectangle bounding the text
TextInfo Structure whose members set the drawing information
Text The text that is drawn. (the terminus is NULL)
EnableFontScale Scales the font so the text fits within the specified rectangle. [True (nonzero): Fonts are scaled, False (0): Fonts are not scaled]
Clip Clips the text that does not fit within the specified rectangle [True (nonzero): Text is clipped, False(0):Text is not clipped]
DeviceMode The designated object where the text is drawn (0: Screen, 1: Printer, 2: Image data)

Return Value

Returns True (nonzero) if successful. Returns False (0) if unsuccessful.

Explanation

The IKDrawText function draws text in a rectangle specified in the designated object (the screen, printer, or image data). The (left, top), and (right, bottom) parameters specify the location of a rectangle in which the text is drawn. If the EnableFontScale parameter is True (nonzero) and the specified text is unable to fit within the rectangle, it will be scaled to fit. However, after scaling if the text still will not fit within the rectangle, the text will be clipped. If the EnableFontScale parameter is False (0), the font will be used as is without scaling. If the text does not fit within the rectangle, the text will be continued on a new line with the line break occuring at a space. (CRLF can also be used). If the Clip parameter is True (nonzero), the characters of the text that do not fit within the specified rectangle will be cut. If the Clip parameter is False (0), then all of the characters in the text will be drawn even if they do not fit inside the rectangle.

Regardless of the text direction or the rotation of the characters, text will be drawn from the start position to the right (or down in the case of vertical text).

When using the IKDrawText function the following members of the TextInfo should be set: CharSet, TextColor1, TextColor2, FontName, FontSize, Transparent, Direction, CharAngle, CharExtra, HCentering, VCentering, and HotkeyPrefix. The CharAngle is enabled for 0, 90, 180, and 270 degree rotations only. When the EnableFontScale parameter is False (0), the CharAngle, Direction, and VCentering are disabled. When the HotkeyPrefix is set to zero, prefixed string functionality cannot be used.

If the DeviceMode parameter is 0 or 2 then PrintRect member variables are in pixel units.

If the DeviceMode parameter is 1 then PrintRect member variables are in 0.1mm units.

The differences from the ImageKit5

Function Name parameters
IK5DrawText: DeviceValue, PrintRect, PrintInfo
IKDrawText: DeviceValue, PrintRect, TextInfo, Text, EnableFontScale, Clip, DeviceMode

Although the PrintInfo and TextInfo structures are different, the member variable needed when using these structures is nearly the same.

IK5PRINT_DATA --> IKPRINT_TEXTINFO
CharExtra, CharSet, RotateString, Alpha1,Alpha2, and HotkeyPrefix have been added and Text has been deleted.
TextForeColor and TextBackColor have been renamed to TextColor1 and TextColor2.

By setting PrintInfo.Text to the Text parameter; setting the value used in IK5SetDeviceMode to the DeviceMode parameter; setting the TextInfo's CharSet to -1, CharExtra to 0, HotkeyPrefix to 1; and setting TextForeColor and TextBackColor to TextColor1 and TextColor2 respectively; this function will operate the same as in the ImageKit5.

The differences from the ImageKit6

Alpha1, Alpha2, and HotkeyPrefix have been added to the IKPRINT_TEXTINFO structure, and the TextForeColor and TextBackColor have beed renamed to the TextColor1 and TextColor2. If the HotkeyPrefix is set to 1, and the TextForeColor and TextBackColor are set to TextColor1 and TextColor2, then this function is the same as in ImageKit6.

 

The ImageKit9 VCL is a product created by Newtone Corporation