频道分类

Delphi显示圆形头像circle image

作者:admin 来源: 日期:2020/2/20 21:09:41 人气: 标签:

 
测试环境及功能
Win7 64位操作系统
Delphi 10.2.3
Firemonkey
功能:Delphi显示圆形头像
procedure TForm5.Button1Click(Sender: TObject);
var path : string;
begin
  {$IFDEF MSWINDOWS}
    path := ExpandFileName(GetCurrentDir) + '\bebe1.jpg';
  {$ELSE}
    path := TPath.GetDocumentsPath + PathDelim + 'bebe1.jpg';
  {$ENDIF}
  Circle1.Fill.Bitmap.Bitmap.LoadFromFile(path);
end;

procedure TForm5.Button2Click(Sender: TObject);
var
  idhttp : TIdHTTP;
  memStream: TMemoryStream;
begin
  try
    memStream := TMemoryStream.Create();
    idhttp    := TIdHTTP.Create();
    idhttp.Get('http://i.imgur.com/2peTq0G.jpg',memStream);
    Circle1.Fill.Bitmap.Bitmap.LoadFromStream(memStream);
  finally
    memStream.Free;
    idhttp.Free;
  end;
end;
来源:https://www.amingstudio.com/delphi/551.html