本文整理自网络,侵删。
代码文件:unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); end;
var Form1: TForm1;
implementation
{$R *.dfm}
uses GDIPOBJ, GDIPAPI, UrlMon;
procedure TForm1.Button1Click(Sender: TObject);const TestPath = 'c:\temp\net.gif'; {下载后临时存放} DownUrl = 'http://del.cnblogs.com/Images/xml.gif'; {要下载的文件}var img: TGPImage; g: TGPGraphics;begin if UrlDownloadToFile(nil, DownUrl, TestPath, 0, nil) = 0 then begin img := TGPImage.Create(TestPath); g := TGPGraphics.Create(Canvas.Handle); g.DrawImage(img, 10, 10, img.GetWidth, img.GetHeight); g.Free; img.Free; end;end;
end.
相关阅读 >>
Delphi一个非常完整的取windows os 版本信息的函数
Delphi:窗体的扩展样式gwl_exstyle用于setwindowlong
更多相关阅读请进入《Delphi》频道 >>