insert image from file at position on a canvas lazarus / 39-Graphics ---------------------------------------------------------------------- T-bear · 2011-05-27 20:57 Hi all Is it possible to insert a image from a file in a position on the canvas of for eksample form1? If yes, how can i do that? Thanks for your help. ---------------------------------------------------------------------- eny · 2011-05-27 21:08 Quote from: T-bear on May 27, 2011, 10:57:25 pmHi all Is it possible to insert a image from a file in a position on the canvas of for eksample form1? If yes, how can i do that? Thanks for your help. The easiest way probably is to put a TImage on the form anywhere you like. And load an image in there (statically or dynamically). ---------------------------------------------------------------------- Dibo · 2011-05-27 21:53 Quote from: T-bear on May 27, 2011, 10:57:25 pmHi all Is it possible to insert a image from a file in a position on the canvas of for eksample form1? If yes, how can i do that? Thanks for your help. You mean something like this? "FormPaint" method is Form.OnPaint event. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1;  {$mode objfpc}{$H+} interface uses  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs;  type   { TForm1 }   TForm1 = class(TForm)    procedure FormCreate(Sender: TObject);    procedure FormDestroy(Sender: TObject);    procedure FormPaint(Sender: TObject);  private    { private declarations }    FImage: TPicture;  public    { public declarations }  end;  var  Form1: TForm1;  implementation {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject);begin  FImage := TPicture.Create;  FImage.LoadFromFile('3d.png');end; procedure TForm1.FormDestroy(Sender: TObject);begin  FImage.Free;end; procedure TForm1.FormPaint(Sender: TObject);begin  Self.Canvas.Draw(5,5,FImage.Graphic);end; end. ---------------------------------------------------------------------- eny · 2011-05-27 22:10 Quote from: Dibo on May 27, 2011, 11:53:14 pmYou mean something like this? "FormPaint" method is Form.OnPaint event.You make it more difficult then it should be. I mentioned TImage for a reason: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   with TImage.Create(self) do  begin    Parent  := self;    Picture.LoadFromFile('image.jpg');    Left    := 20;    Top     := 20;    Stretch := true;    /// other properties like width, height etc.  end;Once created with owner and parent set to 'self' there is no need to destroy or paint it. It's all handled automatically. ---------------------------------------------------------------------- Dibo · 2011-05-27 22:17 Yes, I know that . I just answered to his question, because maybe he have some reasons to draw image exactly on the form canvas. We don't know that.