[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Graphics' (#lcl)

TCustomIcon.GetBestIndexForSize

Gets the ordinal position for the image closest to the requested size.

Declaration

Source position: graphics.pp line 1675

public function TCustomIcon.GetBestIndexForSize(

  ASize: TSize

):Integer;

Arguments

ASize

  

TSize instance with the height and width for the requested image size.

Function result

Ordinal position for the image, or -1 when no images are available.

Description

The default icon size from GetSystemMetrics is used when ASize does not have explicit values in its cx and cy members. The best color depth is determined using the GetDeviceCaps routine for the screen context.

GetBestIndexForSize iterates over the items in the internal image list to find the TIconImage which most closely matches the required values. The return value is -1 if no images are stored in the internal image list for the icon.


Version 3.2 Generated 2024-02-25 Home