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

# TButtonGlyph.GetImageIndexAndEffect

Gets the index for a button image using a given state, and the effect used to draw it.

## Declaration

Source position: buttons.pp line 124

`public procedure TButtonGlyph.GetImageIndexAndEffect(`
`State: TButtonState;`
`APPI: Integer;`
`const ACanvasScaleFactor: Double;`
`out AImageResolution: TScaledImageListResolution;`
`out AIndex: Integer;`
`out AEffect: TGraphicsDrawEffect`
`);`

## Arguments

`State` |  | Drawing state for the button glyph.
`APPI` |  | Pixels per inch for the image resolution with the button glyphs.
`ACanvasScaleFactor` |  | Canvas scaling factor applied to the image resolution.
`AImageResolution` |  | Returns the scaled image resolution with the button glyphs.
`AIndex` |  | Returns the index for the glyph image selected from Images or LCL glyph resources
`AEffect` |  | Returns the drawing effect needed for the glyph image with the specified state.

## Description

GetImageIndexAndEffect is a procedure used to get the ordinal position for the image used to render the Glyph for the class instance. In addition, it returns the image resolution for the specified display density and the drawing effect for the button State.

GetImageIndexAndEffect uses ThemeServices to determine if drawing effects are automatically applied to glyph images, and captures the effect in the AEffect output argument.

GetImageIndexAndEffect determines the image source and the ordinal position for the image used for the button glyph. ExternalImages and ExternalImageIndex are used (when assigned). The next available source is the resource name specified in LCLGlyphResourceName (when specified). Finally, the Images property is used (when assigned). When the image source has been determined, the correct image resolution for the value in APPI is selected and stored in AImageResolution. ImageIndexes is used to get the position for the image with the specified button State.

GetImageIndexAndEffect is used in in the implementation of the Draw method in TButtonGlyph, and in the GetGlyphSize method in TCustomSpeedButton.

## See also

TButtonGlyph.ExternalImages |  | Contains a reference to an external list of images that can be used as the Glyph image,
TButtonGlyph.ExternalImageIndex |  | Ordinal position for the bitmap in ExternalImages displayed when the button is Up (not pressed).
TButtonGlyph.LCLGlyphName |  | Stores the standard LCL resource name used for the Glyph in the class instance.
TButtonGlyph.Images |  | The list of available images for the button glyph.
TButtonGlyph.Draw |  | Draws the glyph for the button using the specified settings and state.
TCustomSpeedButton.GetGlyphSize |  | Gets the size of the glyph within the specified PaintRect.