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

# TCustomImageList.OnGetWidthForPPI

Event handler used to override the scaled width for a display density.

## Declaration

Source position: imglist.pp line 425

`public property TCustomImageList.OnGetWidthForPPI : TCustomImageListGetWidthForPPI read FOnGetWidthForPPI write FOnGetWidthForPPI;`

## Description

OnGetWidthForPPI is a TCustomImageListGetWidthForPPI property that implements the event handler signalled to get the width for images using a specified display density (Pixels per Inch). OnGetWidthForPPI allows an application to override image width values derived using the automatic scaling features in TCustomImageList.

OnGetWidthForPPI is signalled when the GetWidthForPPI method is called, and when reading the value for the WidthForPPI property. The event is the last action performed (when assigned) in the GetWidthForPPI method. It can be used in situations where automatic image scaling is not enable using the Scaled property. It can also be used when the automatic scaling algorithm in GetWidthForPPI produces undesirable results (or performance) for certain high density displays.

Assign an object procedure using the TCustomImageListGetWidthForPPI type to the event handler which handles image width calculations or substitutions. The image width is returned in the AResultWidth parameter for the event handler.

For example:

    procedure TForm1.ImageList1GetWidthForPPI(Sender: TCustomImageList;
      AImageWidth, APPI: Integer; var AResultWidth: Integer);
    begin
      AResultWidth := AImageWidth * APPI div 96;
    end;

## See also

TCustomImageListGetWidthForPPI |  | Specifies an event handler used to get image widths for a display density (PPI).
TCustomImageList.WidthForPPI |  | Image width needed for the specified display density (PPI).