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: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41:
| procedure ScaleImageList(il:TImageList; destwidth,destheight:integer); overload; var newil:TImageList; i:integer; bmps,bmpd:TBitmap; begin newil:=TImageList.Create(nil); try bmps:=TBitmap.Create; try bmps.SetSize(il.Width,il.Height); bmpd:=TBitmap.Create; try bmpd.SetSize(destwidth,destheight); newil.Width:=destwidth; newil.Height:=destheight; for i:=0 to il.Count-1 do begin bmps.Canvas.Brush.Style:=bsSolid; bmps.Canvas.Brush.Color:=clYellow; bmps.Canvas.FillRect(rect(0,0,il.Width+1,il.Height+1)); il.GetBitmap(i,bmps); StretchBlt(bmpd.Canvas.Handle,0,0,destwidth,destheight,bmps.Canvas.Handle, 0,0,il.Width,il.Height,SRCCOPY); newil.AddMasked(bmpd,bmpd.Canvas.Pixels[0,bmpd.height-1]); end; il.Clear; il.Width:=destwidth; il.Height:=destheight; il.AddImages(newil); finally bmpd.Free; end; finally bmps.Free; end; finally newil.Free; end; end; |