Vcl.Graphics.TCustomCanvas.TextWidth
Delphi
function TextWidth(const Text: string): Integer;
C++
int __fastcall TextWidth(const System::UnicodeString Text);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | Vcl.Graphics.pas Vcl.Graphics.hpp |
Vcl.Graphics | TCustomCanvas |
Description
Returns the width, in pixels, of a string rendered in the current font.
Use TextWidth to determine the length a string will occupy in the image. TextWidth indicates whether a given string will fit in the available space. Other graphical elements in the image such as lines or additional strings can be positioned to accommodate the width of the text.
You can use TextExtent to obtain the same value.
See Also
Code Examples