[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'FileCtrl' (#lcl)

# MinimizeName

Returns a shortened version of the specified file name that fits within the number of pixels in MaxWidth.

## Declaration

Source position: filectrl.pp line 229

`function MinimizeName(`
`FileName: string;`
`Canvas: TCanvas;`
`MaxWidth: Integer`
`):string;`

## Arguments

`FileName` |  | File name examined and shortened in the routine.
`Canvas` |  | Canvas with the font used to measure the file name.
`MaxWidth` |  | Maximum width (in pixels) for the file name on the canvas.

## Function result

File name shortened to the maximum length when needed.

## Description

This function will return a shortened version of FileName which fits within the number of pixels given in MaxWidth. For example: 'C:\Documents and Settings\User\Application Data\Microsoft\Word\custom.dic' would be shortened to a value like: 'C:\...\Word\custom.dic'.

No actions are performed in the routine when path information is not included in FileName. The function normalizes all path delimiters in the file name to the first path delimiter found in the FileName argument.

MinimizeName uses the Font currently assigned to the Canvas argument to calculate the width (in pixels) for the file name. When the width of the FileName argument is larger than the value in MaxWidth, directory names are dropped and replaced with a single '...' string value until the shortened file name fits within the specified width. Please note that the replacement characters are a string with three (3) Period ('.') characters, and NOT an Ellipsis (…)(#$2026) character.