Mega Code Archive

 
Categories / Delphi / Examples
 

Display a long path as c pathmyfile txt

To display a (potential) long path shortened in the format shown above, you may use the function MinimizeName from Delphi's unit FileCtrl. In case you were using a TLabel, you can register the component TPathLabel (declared in the same unit); TPathLabel uses MinimizeName to display the caption. // \Delphi\Source\Vcl\FileCtrl.pas unit FileCtrl; function MinimizeName(const Filename: TFileName; Canvas: TCanvas; MaxLen: Integer): TFileName; type TPathLabel = class(TCustomLabel);