This is working in Ubuntu 10.10
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
PaintBox1: TPaintBox;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
Btmp:TBitmap;
implementation
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
PaintBox1.Canvas.Clear;
PaintBox1.Canvas.CopyRect(rect(0,0,100,100),Btmp.Canvas,rect(0,0,100,100));
PaintBox1.Canvas.Brush.Color:=clRed;
PaintBox1.Canvas.Rectangle(10,10,50,50);
end;
procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
Btmp.Free;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Btmp:=TBitmap.Create;
Btmp.LoadFromFile('Flare.bmp');
end;
initialization
{$I unit1.lrs}
end.