いくつかの画像をオブジェクトリストにロードしてから、それらを呼び戻そうとします。しかし、それは画像を表示していませんか?
procedure TForm1.LoadImages(const Dir: string);
var
i: Integer;
CurFileName: string;
JpgIn: TJPEGImage;
BmpOut: TBitmap;
begin
//sets index for object list
CurIdx := -1;
i := 0;
while True do
begin
//gets current folder
CurFileName := Format('%s%d.jpg',
[IncludeTrailingPathDelimiter(Dir), i]);
if not FileExists(CurFileName) then
Break;
//creates jpgin
JpgIn := TJPEGImage.Create;
try
//loads jpgin
JpgIn.LoadFromFile(CurFileName);
//creates TBitmap and sets width to same as jpgs
BmpOut := TBitmap.Create;
bmpout.Width := jpgin.Width;
bmpout.Height := jpgin.Height;
try
BmpOut.Assign(JpgIn);
//if i assign it here it works, showing last image of course
//zimage1.Bitmap.Width := bmpout.Width;
//zimage1.Bitmap.Height := bmpout.Height;
//ZImage1.Bitmap.Assign(bmpout);
//adds 1 to index for object list. thus starting at 0
curIdx := curIdx+1;
//add bitmap to objectlist
CurIdx:= mylist.Add(TBitmap(bmpout));
finally
//free bitmap and jpg
BmpOut.Free;
end;
finally
JpgIn.Free;
end;
Inc(i);
end;
//makes sure cout is above 0
if mylist.Count > 0 then
begin
//create bitmap
BmpOut := TBitmap.Create;
try
//sets width and heigh of bitmap before getting image
bmpout.Height := TBitmap(mylist[curidx]).Height;
bmpout.Width := TBitmap(mylist[curidx]).Width;
bmpout.Assign(TBitmap(mylist[CurIdx]));
//sets zimage width height before getting image.
zimage1.Bitmap.Width := bmpout.Width;
zimage1.Bitmap.Height := bmpout.Height;
ZImage1.Bitmap.Assign(bmpout);
finally
BmpOut.Free;
end;
end;
page:= '0';
end;
あなたが気づいたら、私はそこにこの部分があり、画像をzimage1にロードすることが問題であったかどうかを確認しました。
//zimage1.Bitmap.Width := bmpout.Width;
//zimage1.Bitmap.Height := bmpout.Height;
//ZImage1.Bitmap.Assign(bmpout);
私がそれをしたとき、それはbmpoutをzimage1にロードしました、それは私にそのiamが間違っているオブジェクトリストで何かを考えるように導きますか?