Создается игра про пазл, скачивал некоторые исходники. Ругается на il.Items.Clear;
Procedure TBrowseFrm.LoadImg(dir:string);
var
n:integer;
bmp:Tbitmap;
tmp:Tbitmap;
r:trect;
begin
if not DirectoryExists(dir) then exit;
OwnerImg:=false;
fnList:=TstringList.Create;
SearchFiles(dir);
if fnList.Count=0 then
begin
fnList.Free;
exit;
end;
il.Items.Clear;
MySpeedButton2.Enabled:=false;
MySpeedButton1.Enabled:=false;
label1.Caption:='Î÷èñòêà êýøà';
if directoryexists(extractFilePath(application.ExeName)+'cache') then
clearFolder(extractFilePath(application.ExeName)+'cache') else
createDir(extractFilePath(application.ExeName)+'cache');
Label1.Caption:='Âíèìàíèå! Çàãðóçêà ýñêèçîâ...';
ProgressBar1.Position:=0;
ProgressBar1.Max:=fnList.Count-1;
for n:=0 to fnList.Count-1 do
with il.Items.Add do
begin
Caption:='';
TransparentColor:=ClWhite;
Transparent:=True;
end;
grid.TopRow:=0;
grid.ScrollBy(0,0);
grid.ColCount:=grid.Width div grid.DefaultColWidth;
grid.RowCount:=il.Count div grid.ColCount;
if grid.RowCount*grid.ColCount < il.Count then
grid.RowCount:=grid.RowCount+1;
bmp:=Tbitmap.Create;
tmp:=Tbitmap.Create;
bmp.PixelFormat:=pf24bit;
tmp.PixelFormat:=pf24bit;
bmp.Width:=grid.DefaultColWidth-6;
bmp.Height:=grid.DefaultRowHeight-6;
dir:=ExtractFilePath(application.ExeName)+'cache\';
for n:=0 to FNList.Count-1 do
begin
try
LoadBmpFromJpegFile(tmp,FNList[n],false);
r:=destrect(tmp.width,tmp.height,bmp.Width,bmp.Height);
PatBlt(bmp.Canvas.Handle,0,0,bmp.Width,bmp.Height,WHITENESS);
SetStretchBltMode(bmp.Canvas.Handle, 4) ;
StretchBlt(bmp.Canvas.Handle,r.Left,r.Top,r.Right-r.Left,r.Bottom-r.Top,tmp.Canvas.Handle,0,0,tmp.Width,tmp.Height,SRCCOPY);
except
bmp.Canvas.FillRect(rect(0,0,bmp.Width,bmp.Height));
bmp.Canvas.textout((bmp.Width-bmp.Canvas.TextWidth('Error load')) div 2,bmp.Height div 2,'Error load');
end;
getEskiz(n,bmp,FNList[n]);
bmp.SaveToFile(dir+inttostr(n)+'.bmp');
application.ProcessMessages;
end;
fnList.SaveToFile(ExtractFilePath(application.ExeName)+'cache\cache.lst');
fnList.Free;
MySpeedButton2.Enabled:=true;
MySpeedButton1.Enabled:=True;
end;