在VCL中,我有ImageList来存储图像。在FireMonkey中,没有ImageList控件。如何将图像存储在FireMonkey中以备后用?

最佳答案

在FireMonkey(XE4)中添加图像

Project -> Resources and Images


然后访问它:

procedure TForm1.Button1Click(Sender: TObject);
var
  InStream: TResourceStream;
begin
  InStream := TResourceStream.Create(HInstance, 'MyPng', RT_RCDATA);
  try
    Image1.Bitmap.LoadFromStream(InStream);
  finally
    InStream.Free;
  end;
end;


感谢PeterVonča

10-05 22:16