Delphi:TEllPath - a label control for displaying lengthy file paths
When using a TLabel control to display file or directory paths it isn't long before the need arises to display a path that is too long to fit in the maximum width available for the label with the result that text spills over on to a new line - never a desirable effect. The standard approach to this problem is to partially replace the text with an ellipsis, ..., character. Fortunately the Windows GDI function DrawTextEx can be easily instructed to make such a replacement. TEllPath shows how this should be done.
Usage: Register TEllPath in the components palette of the Delphi IDE. To do this, first open EllPath.PAS, then select
DownloadInstall Componentfrom the
Componentmenu. Read the comments in EllPath.PAS to configure it to your own needs. Use the Caption property of TEllPath in the same way as for a TLabel.