JCL Help:PathCompactPath
JCL Help: PathCompactPath Function
Search in JCL Help
Search in all projects
Summary
Compacts a path to fit within the given pixel width.
Pascal
function PathCompactPath(const DC: HDC; const Path: string; const Width: Integer; CmpFmt: TCompactPath): string;
Parameters
Parameters | Description |
const DC: HDC | Device context used for retrieving font metrics. This should be the canvas on which you eventually intend to display the compacted path. |
const Path: string | The path to compact or truncate. |
const Width: Integer | Width, in pixels, that the path will be forced to fit within. |
CmpFmt: TCompactPath | Determines which part of the string is replaced with an ellipsis. Valid values are: cpCenter, cpEnd |
Return Value
The compacted path or an empty string if the function fails.
Description
PathCompactPath compacts, or truncates, the path to fit within the given pixel width by replacing part of the string with an ellipsis (...). The specified device context is used to retrieve the font metrics which determine how a string maps to a pixel width. Note the existence of two overloads allowing you to pass in either an HDC or TCanvas (descendant). The TCanvas overload simply delegates the work to the first overload passing in Canvas.Handle for the DC parameter.
About
Unit
Donator
Marcel van Brakel
Contributors
Anonymous
Platforms
Windows
Notes
If Width is smaller than the most compacted path then the result is the most compacted path, even though it does not fit within the specified width.
Contribute to this help topic
This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page