Recent

Author Topic: Use Timage manualy or with GUI help  (Read 515 times)

coradi

  • Full Member
  • ***
  • Posts: 148
Use Timage manualy or with GUI help
« on: November 16, 2022, 08:15:16 pm »
If  want to place a picture in TForm, I click on TImg in Lazarus Menu and pace it in TForm.

If I want now, set the link to the picture, what is the better way?
1.I click anywhere in TForm an then write the path to the BMP into it?

Code: [Select]
procedure TForm1.FormCreate(Sender: TObject);
begin
try
 image1.picture.loadFromFile('C:\temp\test.bmp');
end;
[/code)

or
2.I let this Formcreate empty, an use the GUI to set the path.

[code]procedure TForm1.FormCreate(Sender: TObject);
begin

end;

I think, the 1st solution is the cleaner one? But the 2nd ist so much easier...
And now?!
Amstrad Schneider CPC 6128
AVR8/ARM(STM32)

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2097
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Use Timage manualy or with GUI help
« Reply #1 on: November 16, 2022, 08:56:28 pm »
In my experience, when your picture is fixed, I mean static like, never changing, than it is best to place TImage on formular like you want it to be, within Object Inspector find the "Picture" property and load there your picture in, that way your picture data is saved to the formular and your redistributable executable does not need the original graphic file anymore.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

 

TinyPortal © 2005-2018