This method retrieves the height and width of the text from the text information.

[Visual Basic]   [ Boolean = ]imagekitcontrolname.PrintDraw.GetTextExtent(hDC As LONG_PTR, Width As Long, Height As Long, UnitMode As DeviceUnitModeConstants)
[Visual C++]     [ BOOL = ]imagekitcontrolname.GetPrintDraw().GetTextExtent(LONG_PTR hDC, long *Width, long *Height, long UnitMode)
[VB.NET]   [ Boolean = ]imagekitcontrolname.PrintDraw.GetTextExtent(hDC As Integer(x86) or Long(x64), ByRef Width As Integer, ByRef Height As Integer, UnitMode As ImageKit9(A)Lib.DeviceUnitModeConstants)
[C#.NET]   [ bool = ]imagekitcontrolname.PrintDraw.GetTextExtent(int(x86) or long(x64) hDC, ref int Width, ref int Height, ImageKit9(A)Lib.DeviceUnitModeConstants UnitMode)

* ImageKit9ALib refers to the ANSI version, ImageKit9Lib refers to the Unicode version, (x86) refers to the 32 bit version, and (x64) refers to the 64 bit version.

Parameters

Name Explanation
hDC The device context
Width Retrieves the width of the text
Height Retrieves the height of the text
UnitMode The units of measure of the retrieved values (0: pixels, 1: 0.1mm)

The following constants can be used: (ikPrinterPixel = 0, ikPrinterMM = 1).

Return Value

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

Explanation

The GetTextExtent method retrieves the height and width of the text from the text information (single line only). To execute this method the CharSet, FontName, FontSize, Direction, CharAngle, and RotateString properties should be set. If the CharExtra property value is 1 or more, the values returned in the Width and Height parameters will reflect the additional space between characters. When the RotateString property is False, regardless of the direction of the text or the rotation of the characters, the Width parameter refers to the horizontal size of the text and the Height parameter refers to the vertical size of the text. When the RotateString property is True, the Width parameter refers to the size of the text in the direction that it is drawn and the Height parameter refers to the size of the text in the vertical direction. When the RotateString is False, the CharAngle property is enabled only for values of 0, 90, 180, and 270 degrees.

For scripting languages, other programs that require variant types, or when using 64 bit builds in VB.NET or C#, please refer to the GetTextExtentVariant method.

If the UnitMode parameter is 0 then the Width and Height parameters will be in pixel units.

If the UnitMode parameter is 1 then the Width and Height parameters will be in 0.1mm units.

Differences between the ImageKit7/8

The hDC argument type has changed.

 

The ImageKit9 ActiveX is a product created by Newtone Corporation