implementation
var
Bitmap, tempBmp: TBitmap;
DestRect, SrcRect: TRect;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin //tempBmp contiene la primera fila del Bitmap
tempBmp.Width := BitMap.Width;
tempBmp.Height := Bitmap.Height div 2;
DestRect := RECT(0,0,tempBmp.Width-1, tempBmp.Height-1);
SrcRect:=DestRect;
tempBmp.Canvas.CopyRect(DestRect, BitMap.Canvas, SrcRect);
ImageList1.Width:= Bitmap.Width div 10;
ImageList1.Height:= tempBmp.Height;
ImageList1.AddMasked(tempBmp, tempBmp.Canvas.Pixels[0,0]);
ImageList1.Draw(PaintBox1.Canvas,0,0,1);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin //tempBmp contiene la segunda fila del Bitmap
tempBmp.Width := BitMap.Width;
tempBmp.Height := Bitmap.Height div 2;
DestRect := RECT(0,0,tempBmp.Width-1, tempBmp.Height-1);
SrcRect:=DestRect;
SrcRect.Top := tempBmp.Height;
SrcRect.Bottom := Bitmap.Height-1;
tempBmp.Canvas.CopyRect(DestRect, BitMap.Canvas, SrcRect);
ImageList1.Width:= Bitmap.Width div 10;
ImageList1.Height:= tempBmp.Height;
ImageList1.AddMasked(tempBmp, tempBmp.Canvas.Pixels[0,0]);
ImageList1.Draw(PaintBox1.Canvas,0,0,2);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Bitmap:= TBitmap.Create;
tempBmp:= TBitmap.Create;
BitMap.LoadFromFile(getcurrentdir+'/Doble.BMP');
ImageList1.BkColor:=clNone;
ImageList1.BlendColor:= clNone;
ImageList1.DrawingStyle:= dsTransparent;
ImageList1.Masked:= True;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Bitmap.Free;
tempBmp.Free;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
PaintBox1.Canvas.Fillrect(PaintBox1.Canvas.ClipRect); //Borra el Canvas
end;
end.