I’m in a project and need to put a background image, I would like to make that image responsive, but I can not. I’m using
Timage to insert the image.
There are two ways to do design time or code , let’s go first.
As mentioned by @lucaswmolin, click on component
TImage and on properties you will first define everything in% with% then we will make the component responsive by setting
picture to property
alclient , then in option
align set it to
Stretch to make the image to be opened with the size equal to the component. As you can see in the image below:
Afterthecommentfrom@MuriloPechtthatintheDelphiversion10.2wasnotworkingIwenttotestanditdoesnotreallyworkiftheprojectcreatedisa”Multi-Device Application” the steps for the image to work are as follows: / p>
1st Copy a Timage to the form 2nd In properties set
onCreate to the option
client . > 3rd properties option MultiRestBitmap clicks on the 3 points and we will load the path of the image, see the image below where to load the path:
To use the code option, simply use the following:
procedure TForm1.FormCreate(Sender: TObject); begin //vai abrir a imagem Image1.MultiResBitmap.bitmap.LoadFromFile('caminho'); //define o tamanho do componente ao form Image1.Align := TAlignLayout.Client; end;