BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Gdi+ and png

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Mon May 21, 2007 4:05 pm    Post subject: Gdi+ and png Reply with quote



Hello,
I can not load a png file from TMemoryStream. If the file format is
jpg, the code below is ok, but if the file is png, it raise a error.
Who can tell me the reason and how to deal with it.

Thanks.

var
PicStream:TStream;
StreamAdapter:TStreamAdapter;
FBitmap:TGPBitmap;
g:TGPGraphics;
begin
PicStream:=TMemoryStream.Create;
TMemoryStream(PicStream).LoadFromFile('d:\1\1.png');
PicStream.Seek(0,sobeginning);
StreamAdapter:=TStreamAdapter.Create(PicStream,soReference);
FBitmap:=TGPBitmap.Create(StreamAdapter);
g:=TGPGraphics.Create(self.Canvas.Handle);
g.DrawImage(FBitmap,0,0);
g.Free;
PicStream.Free;
FBitmap.Free;
end;
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.