简体   繁体   中英

Resource Not Found for firemonkey app

I am building a firemonkey mobile application.

I have gone to projects -> Resources and Images.

Added "statusled.png" and the identifier is "LedOff" type "RCDATA"

In my form2.FormShow procedure I have this:

var
   offLed: TBitmap;

implementation

procedure TForm2.FormShow(Sender: TObject);
var
  jsonObj: TJSonObject;
  T: TResourceStream;

  litem: TListViewItem;
begin
  T := TResourceStream.Create(HInstance, 'LedOff', 'RT_RCDATA');
  offLed.Create;
  offLed.LoadFromStream(T);
end;

When I run this and form2 opens I get "Resource LedOff not found" why is this?

The resource type should not be quoted:

T := TResourceStream.Create(HInstance, 'LedOff', RT_RCDATA);

Note that offLed.Create looks very dubious. I suspect that should read offLed := TSomeClass.Create where TSomeClass might be TBitmap , but only you can tell for sure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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