Skip to main content
Table of Contents

TTMSFNCImage.Stretch Property

When True, stretches the bitmap to fill the available paint rectangle.

API unit family: TMSFNCImage Declaring type: TTMSFNCImage Inherited from: TTMSFNCCustomImage Type: Boolean

Syntax

FMX.TMSFNCImage.hppPascalC++
property Stretch: Boolean;
__property bool Stretch = {read=FStretch, write=SetStretch, default=0};

Default: False

Remarks

Default value is False.

Usage examples

Fit an image inside a fixed rectangle

Preserves the aspect ratio while filling the available image area.

Fit an image inside a fixed rectanglePascalC++
procedure TForm1.ConfigureImageFitting;
begin
  TMSFNCImage1.AspectRatio := True;
  TMSFNCImage1.Stretch := True;
  TMSFNCImage1.Center := True;
  TMSFNCImage1.Cropping := False;
  TMSFNCImage1.BitmapMargins.Left := 8;
  TMSFNCImage1.BitmapMargins.Right := 8;
  TMSFNCImage1.BitmapMargins.Top := 8;
  TMSFNCImage1.BitmapMargins.Bottom := 8;
end;

void __fastcall TForm1::ConfigureImageFitting()
{
  TMSFNCImage1->AspectRatio = true;
  TMSFNCImage1->Stretch = true;
  TMSFNCImage1->Center = true;
  TMSFNCImage1->Cropping = false;
  TMSFNCImage1->BitmapMargins->Left = 8;
  TMSFNCImage1->BitmapMargins->Right = 8;
  TMSFNCImage1->BitmapMargins->Top = 8;
  TMSFNCImage1->BitmapMargins->Bottom = 8;
}

Read the related guide