Navigation:  thinBasic Modules > UI (User Interface) > Dedicated Control Functions > Canvas Control >

Canvas_GetTextWidth

Previous pageReturn to chapter overviewNext page

 

Description

 

Calculates the total width size of a string, based on the current font for the canvas target.

 

Syntax

 

n = Canvas_GetTextWidth( StringExpression )

 

Returns

 

Number

 

Parameters

 

Name

Type

Optional

Meaning

StringExpression

String

No

Any string expression

 

Remarks

 

The size returned is specified in the same terms (pixels or dialog units) as the parent dialog (or world coordinates, if those were chosen with Canvas_Scale).

This allows you to easily calculate the appropriate print position, particularly when using a proportional font.

 

Restrictions

 

See also

 

Examples