您的位置:程序门 -> delphi -> 非技术区



请问怎样将图片的文件流存到文本文件中,然后再用image通过打开这个文本文件显示图片


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


请问怎样将图片的文件流存到文本文件中,然后再用image通过打开这个文本文件显示图片
发表于:2008-01-05 16:10:30 楼主
请问怎样将图片的文件流存到文本文件中,然后再用image通过打开这个文本文件显示图片
现在已经写到文本了,用windows的画板也能打开,就是用程序打不开
发表于:2008-01-05 16:29:521楼 得分:0
文本文件是不是.txt     扩展名问题啊  

    image.picture.loadfromfile(filename);
这样不行吗?
发表于:2008-01-05 16:38:262楼 得分:0
不行
我把文件流写到文本文件里,显示的是乱码,但是能用画板打开
但是image.picture.loadfromfile(filename);  
不行
发表于:2008-01-05 16:39:403楼 得分:0
procedure   tform1.button1click(sender:   tobject);
var
msme:tmemorystream;
begin
  try
msme   :=   tmemorystream.create;
foreimage.picture.graphic.savetostream(msme);
msme.savetofile('c:\1.txt');
finally
freeandnil(msme);
end;

end;
//写文件的
procedure   tform1.button2click(sender:   tobject);
var
    m1:tfilestream;
    m2:tmemorystream;
  mybuf:array   of   pchar;
begin
m1   :=   tfilestream.create('c:\1.txt',fmopenread );
setlength(mybuf,m1.size);
m1.readbuffer(mybuf,m1.size);
showmessage(pchar(mybuf));
m2   :=   tmemorystream.create;
m2.loadfromstream(m1);
image1.picture.graphic.loadfromstream(m2);
end;
end.
//打开的


快速检索

最新资讯
热门点击