Author: Jonas Bilinkevicius
I want to draw a directory path on a canvas, but then I have a fixed width for the
canvas. So I would like to truncate long directory names to fit in the canvas like
"C:\Directory1\Directory2\Directory3\Directory4\Aaahhh\Finally" should be truncated
to "C:\...\Aaahhh\Finally" or "C:\...\Finally" depending on width available.
1 2 procedure DrawPath(ACanvas: TCanvas; const Path: string; Rect: TRect);
3 begin4 DrawText(ACanvas.Handle, PChar(Path), -1, Rect, DT_PATH_ELLIPSIS);