P
prtmon
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);
var
fs:TMemoryStream;
GPGraphics:TGPGraphics;
Stream:TStreamAdapter;
GPImage:TGPImage;
begin
fs:=TMemoryStream.Create;
Stream:=TStreamAdapter.Create(fs,soOwned);
fs.LoadFromFile('plbtn_Over.png');
GPImage:=TGPImage.Create(Stream);
GPGraphics:=TGPGraphics.Create(Image1.Canvas.Handle);
GPGraphics.DrawImage(GPImage,0,0);
Image1.Update;
GPGraphics.Free;
GPImage.Free;
Showmessage('到最后啦');
end;
调试时:
GPImage:=TGPImage.Create(Stream);这句代码出错,跟踪进去发现是TGPImage.loadfromstream出错,只有png文件才会出错,其它格式不出错,用loadfromfile也不会出错,但运行时可正常运行。
但是在界面上加一TWebBrowser控件,一打开网页,再运行这段代码,则直接跳出错误,并不能正确执行到最后,png也不能正确画出来,请高手解答。(分只有这么多了,不好意思)
var
fs:TMemoryStream;
GPGraphics:TGPGraphics;
Stream:TStreamAdapter;
GPImage:TGPImage;
begin
fs:=TMemoryStream.Create;
Stream:=TStreamAdapter.Create(fs,soOwned);
fs.LoadFromFile('plbtn_Over.png');
GPImage:=TGPImage.Create(Stream);
GPGraphics:=TGPGraphics.Create(Image1.Canvas.Handle);
GPGraphics.DrawImage(GPImage,0,0);
Image1.Update;
GPGraphics.Free;
GPImage.Free;
Showmessage('到最后啦');
end;
调试时:
GPImage:=TGPImage.Create(Stream);这句代码出错,跟踪进去发现是TGPImage.loadfromstream出错,只有png文件才会出错,其它格式不出错,用loadfromfile也不会出错,但运行时可正常运行。
但是在界面上加一TWebBrowser控件,一打开网页,再运行这段代码,则直接跳出错误,并不能正确执行到最后,png也不能正确画出来,请高手解答。(分只有这么多了,不好意思)