即ACCESS中有两个字段,一个是ID,一个是picture,能实现在一个界面中显示它的缩略图,用于展示。比如一次显示前五个记录中的图片,然后可以点翻页,接着显示其它的图片,达到遍历。程序中有流来读取ACCESS中的图片,格式为jpgfunction JpegStartsInBlob(PicField:TBlobField):integer;//找起始标记函数
var
bs:TADOBlobStream;
buffer:Word;
hx:string;
begin
Result:=-1;
bs:=TADOBlobStream.Create(PicField,bmRead);
try
while(Result=-1) and (bs.Position+1<bs.Size) do
begin
bs.ReadBuffer(buffer,1);
hx:=IntToHex(buffer,2);
if hx='FF' then
begin
bs.ReadBuffer(buffer,1);
hx:=IntToHex(buffer,2);
if hx='D8' then Result:=bs.Position-2
else if hx='FF' then
bs.Position:=bs.Position-1;
end;
end;
finally
bs.Free
end;
end;
procedure TForm1.Button1Click(Sender: TObject);//读取图片
var
bs:TADOBlobStream;
pic:TJpegImage;
begin
bs:=TADOBlobStream.Create(AdoTable1Picture,bmRead);
try
bs.Seek(JpegStartsInBlob(AdoTable1Picture),soFromBeginning);
pic:=TJpegImage.Create;
try
pic.LoadFromStream(bs);
Image1.Picture.Graphic:=pic;
finally
pic.Free;
end;
finally
BS.Free
end;
end;
我想实现的是能够一次过在同一个界面中显示多个记录的图片,便于浏览,不知道有什么实现方法,或者相关组件呢?
谢谢各位了!
var
bs:TADOBlobStream;
buffer:Word;
hx:string;
begin
Result:=-1;
bs:=TADOBlobStream.Create(PicField,bmRead);
try
while(Result=-1) and (bs.Position+1<bs.Size) do
begin
bs.ReadBuffer(buffer,1);
hx:=IntToHex(buffer,2);
if hx='FF' then
begin
bs.ReadBuffer(buffer,1);
hx:=IntToHex(buffer,2);
if hx='D8' then Result:=bs.Position-2
else if hx='FF' then
bs.Position:=bs.Position-1;
end;
end;
finally
bs.Free
end;
end;
procedure TForm1.Button1Click(Sender: TObject);//读取图片
var
bs:TADOBlobStream;
pic:TJpegImage;
begin
bs:=TADOBlobStream.Create(AdoTable1Picture,bmRead);
try
bs.Seek(JpegStartsInBlob(AdoTable1Picture),soFromBeginning);
pic:=TJpegImage.Create;
try
pic.LoadFromStream(bs);
Image1.Picture.Graphic:=pic;
finally
pic.Free;
end;
finally
BS.Free
end;
end;
我想实现的是能够一次过在同一个界面中显示多个记录的图片,便于浏览,不知道有什么实现方法,或者相关组件呢?
谢谢各位了!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货