Calculates the width (in pixels) of the text displayed in an edit control, in a Combo Box control or in a Static control. This allows you to predict the width occupied by the text in order to enlarge the control if necessary.
ResNbPixels is real = TextWidth(EDT_Edit1, "Hello")
<Result> = TextWidth(<Control name> , <Text> [, <Options>])
Width of the text (in pixels) in the specified control (according to the control style).
You can get the width in millimeters by using the following formula:
<Nb pixels> = <Screen resolution>*<Nb millimeters>/25.4
Remark: The width will be null for the unsupported controls. Only the edit controls and the Static controls are supported.
<Control name>: Character string
Name of the Edit control, Static control or Combo Box control.
Name of the edit control or Static control.
<Text>: Character string
Text whose width must be calculated.
<Options>: Optional integer constant
Configures the mode for calculating the width of the text:
Business / UI classification: UI Code