1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| procedure assign_icon(list_i:timagelist;filename:string);
var bitfile,bittmp,bittmp2:tbitmap;
i:integer;
MyRect,MyOther:TRect;
begin
bitfile:=tbitmap.create;
bittmp:=tbitmap.create;
bittmp2:=tbitmap.create;
bitfile.loadfromfile(filename);
bittmp.Width:=list_i.width; bittmp.height:=list_i.height;
bittmp2.Width:=list_i.width; bittmp2.height:=list_i.height;
for i:= 0 to (bitfile.width div list_i.width) do
begin
MyRect :=Rect(i*list_i.width,0,i*list_i.width+list_i.width,list_i.height);
MyOther :=Rect(0,0,list_i.width,list_i.height);
bittmp.Canvas.CopyRect(MyOther,Bitfile.Canvas,MyRect);
bittmp2.canvas.draw(0,0,bittmp);
Bittmp2.Monochrome :=true;
list_i.add(bittmp,bittmp2);
end;
bitfile.free;
bittmp.Free;
bittmp2.Free;
end; |
Partager