Steve F
Steve F

Reputation: 1587

Delphi - TBitBtn- Invalid image size error

Using: Delphi XE2 Update 4.1

On the form, TImageList with 12x12 images is linked to TActionManager. When selecting the 'Action' property of a TBitBtn on the form, it shows 'Invalid image size' error.

Screenshot attached: enter image description here

Is there limitation on the Glyph sizes that can be attached to BitBtn? If so, its not mentioned in the Help documentation.

Upvotes: 1

Views: 1123

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 597941

The error message means a TGraphic image was passed to the TImageList but the graphic's Height was less than the TImageList.Height, or the graphic's Width was less than the TImageList.Width. There are four conditions where a TGraphic is validated by TImageList:

  1. TCustomImageList.GetImageHandle(), which is called by TCustomImageList.Add(), TCustomImageList.AddMasked(), and TCustomImageList.Replace()

  2. TCustomImageList.AddIcon()

  3. TCustomImageList.ReplaceMasked()

  4. TCustomImageList.ReplaceIcon()

In your case, AddIcon() is being called, so clearly the dimensions of the icon being added to the TImageList are too small.

Upvotes: 1

Related Questions