Vcl.Graphics.TCustomCanvas.TextWidth

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

function TextWidth(const Text: string): Integer;

C++

int __fastcall TextWidth(const System::UnicodeString Text);

プロパティ

種類 可視性 ソース ユニット
function public
Vcl.Graphics.pas
Vcl.Graphics.hpp
Vcl.Graphics TCustomCanvas

説明

現在のフォントで表示されている文字列の幅をピクセル単位で返します。

画像で文字列が占めている長さを決定するには、TextWidth を使用します。TextWidth は指定した文字列が利用可能なスペースに適合するかどうかを示します。画像での他のグラフィック要素(線、追加文字列など)は、テキストの幅に適合するように配置できます。

TextExtent を使用して同じ値を取得できます。

関連項目