DrawTextWidth method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

int DrawTextWidth (System::AnsiString sText);

Delphi Syntax

DrawTextWidth (sText: String): Integer;

Overview

Refer to Drawing Three-Dimensional Shapes and Text.

Remarks

Returns the width of the specified text string, using the current values of the TextFont property.

The scale is relative to the Main Control's client area. The unit of measure is pixels. You can use this method to position the text relative to another drawing object, such as a line or rectangle.

If the DrawPersistence property is TRUE, all drawing is done on the bitmap, not the screen. In this case this method supports 1, 4, 8 palettized, 16 and 24-bit color images. Therefore, to call this method for an image of some other bits per pixel, or a 12 or 16-bit grayscale image, the ColorRes method must be called first to convert that image to a 1, 4, 8 palettized, 16 or 24-bit color image.

If the DrawPersistence property is FALSE, then all drawing is done to the screen. In this case images of all bits per pixel values can be used by this method.

See Also

Elements:

DrawTextStr method

Topics:

Working with the Control: Client Area Usage

 

Raster Images: Drawing on a Bitmap