I would like to write a program for Windows CE 5.0.
As I begun with use a bitmap with 32bit color than I realised that there is a memoryleak.
When I use a 16bit color bitmap than I haven't got this problem.
I would like to show the sourcecode of my program:
I use an image, a button for exit and a timer.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button3: TButton;
Image1: TImage;
ImageList1: TImageList;
Timer1: TTimer;
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
Bitmap01:tBitmap;
implementation
{ TForm1 }
procedure TForm1.Button3Click(Sender: TObject);
begin
form1.Close;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Bitmap01:=tbitmap.Create;
Bitmap01.Width:=100;
Bitmap01.Height:=100;
Bitmap01.PixelFormat:=pf32bit;
Bitmap01.Canvas.Pen.Color:=clred;
Bitmap01.Canvas.Pen.Width:=3;
Bitmap01.Canvas.Brush.Color:=clyellow;
Bitmap01.Canvas.FillRect(2,2,98,98);
timer1.Enabled:=true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
image1.Canvas.Draw(random(100),random(84),Bitmap01);
end;
initialization
{$I unit1.lrs}
end.
What do I wrong?
Thank you for your help in advance!