Topic: How to load a png image in a form using only script
Hello, I'm trying to load an image into a form using only script code but this is not working. Please HELP!!!
procedure Form1_OnShow (Sender: TObject; Action: string);
Var graphics:Tgraphic;
Var image:TImage;
var png: TPNGImage;
var file_path: string;
begin
//file path
file_path:= 'image.png';
//create the image from code
image:=TImage.create(frm_main);
image.Picture.LoadFromFile(file_path);
image.name:='image1';
image.top:=8;
image.left:=8;
image.width:=350;
image.height:=350;
image.autosize:=true;
image.visible:=true;
image.enabled:=true;
//free object
image.free;
end;