简体   繁体   English

delphi中未声明的标识符“ idhttp1”

[英]undeclared identifier “idhttp1” in delphi

I am trying to load an image from a URL in Delphi 2010. 我正在尝试从Delphi 2010中的URL加载图像。

I'm pretty new to Delphi and found this code but keep getting: 我是Delphi的新手,找到了这段代码,但一直得到:

undeclared identifier at idhttp1.get idhttp1.get上未声明的标识符

Do I need to add something to the uses? 我需要添加一些用途吗? Thanks 谢谢

uses
  GIFImg;

procedure TForm1.btn1Click(Sender: TObject);
var
  MS : TMemoryStream;
  GIf: TGIFImage;
begin
  MS := TMemoryStream.Create;
  GIf := TGIFImage.Create;
  try
    IdHTTP1.get('http://www.google.com/intl/en_ALL/images/logo.gif',MS);
    Ms.Seek(0,soFromBeginning);       
    Gif.LoadFromStream(MS);
    img1.Picture.Assign(GIF);

  finally
    FreeAndNil(GIF);
    FreeAndNil(MS);
  end;
end;

The usage suggests that IdHTTP1 is a component of type TIdHTTP that is placed on the design surface of your form. 使用表明IdHTTP1是一种类型的部件TIdHTTP被放置在您的形式的设计图面上。 Likely that is the step that you have missed. 这可能是您错过的步骤。 Once you perform that step the code should compile. 一旦执行了该步骤,就应该编译代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM