蔓 蔓草 Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-16 #1 如何声明一个jpeg图片列表,就象一个Tstring一样,我可以通过其中的索引 访问其中的任何一个图片数据?应该怎么做呢?
K Kingron Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-16 #3 用一个数组不就行了?更简单方便~~~~~~~~~~~~~~~
S shaofun Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-16 #5 类似的问题都可以用TList来解决,TList确实是个好东西
B blue_morning Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-16 #6 1. Pic: array of TBitmap; 2: // Save to List List := TStringList.Create; for i ;= 0 to count do beign List.AddObject('AName', AObject); end; //Uses ObjectType(List.Objects)
1. Pic: array of TBitmap; 2: // Save to List List := TStringList.Create; for i ;= 0 to count do beign List.AddObject('AName', AObject); end; //Uses ObjectType(List.Objects)
蔓 蔓草 Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-16 #8 //Uses ObjectType(List.Objects) 这个具体怎么用,我加了一个Jpeg图片,ObjectType应该怎么写
X xuyingfeng Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-16 #9 用指针 var Pic: array[0..9] of TBitmap; list1:Tlist; begin //加入图片 list1.add(^pic[0]); //读取图片 ^pic[0]=list1.items[0]; end;
用指针 var Pic: array[0..9] of TBitmap; list1:Tlist; begin //加入图片 list1.add(^pic[0]); //读取图片 ^pic[0]=list1.items[0]; end;
蔓 蔓草 Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-16 #10 大家看看我写的代码, Try PicJpg:=TjpegImage.create; PicJpg.LoadFromStream (TADOBlobStream.Create(TBlobField(AqPic.FieldByName('Dt')), bmRead)); sl.AddObject('0',PicJpg); Finally PicJpg.free; end;////在数据库里读出图片,转化成jpg,放在sl这个strings里 使用 var p:Tjpegimage begin p:=Tjpegimage(sl.objects[0]) image1.picture.assign(p);//这里出现了内存错误 end;
大家看看我写的代码, Try PicJpg:=TjpegImage.create; PicJpg.LoadFromStream (TADOBlobStream.Create(TBlobField(AqPic.FieldByName('Dt')), bmRead)); sl.AddObject('0',PicJpg); Finally PicJpg.free; end;////在数据库里读出图片,转化成jpg,放在sl这个strings里 使用 var p:Tjpegimage begin p:=Tjpegimage(sl.objects[0]) image1.picture.assign(p);//这里出现了内存错误 end;
X xianjun Unregistered / Unconfirmed GUEST, unregistred user! 2001-11-16 #12 var I: Integer; PicJpg: TJpegImage; sl: TStrings; begin Sl := TStringList.Create; Try PicJpg:=TjpegImage.create; PicJpg.LoadFromStream (TADOBlobStream.Create(TBlobField(AqPic.FieldByName('Dt')), bmRead)); sl.AddObject('0',PicJpg); Image1.Picture.Assign(Tjpegimage(sl.objects[0])); finally for I := Sl.Count - 1 downto 0 do TJpegImage(Sl.Objects).Free;//在Free Sl时才能把PicJpg:=TjpegImage.create;申请的内存释放 Sl.Free; end;
var I: Integer; PicJpg: TJpegImage; sl: TStrings; begin Sl := TStringList.Create; Try PicJpg:=TjpegImage.create; PicJpg.LoadFromStream (TADOBlobStream.Create(TBlobField(AqPic.FieldByName('Dt')), bmRead)); sl.AddObject('0',PicJpg); Image1.Picture.Assign(Tjpegimage(sl.objects[0])); finally for I := Sl.Count - 1 downto 0 do TJpegImage(Sl.Objects).Free;//在Free Sl时才能把PicJpg:=TjpegImage.create;申请的内存释放 Sl.Free; end;