I am trying to learn how to imbed Graphics in an executable Delphi program. I have created a RES fil;e that contains two graphics. I have created a Procedure that I found on the Internet as follows:
implementation
{$R *.dfm}
{$R MyPic.RES}
procedure TForm_Main.Button_PrintClick(Sender: TObject);
Var
MyPic: TBitMap;
: TResourceStream;
begin
try
MyPic := TBitMap.Create;
ResStream := TResourceStream.CreateFromID(hinstance, 1, RT_RCDATA);
MyPic.LoadfromStream(ResStream);
MyPic.Canvas.Draw(15,15, MyPic);
finally
MyPic.Free;
end;
end;
The program Compiles but fails on Run with the following error message on the highlighted line:
“Project TestPrint.exe raised exception class EResNotFound with Message Resource 1 not found.”
Can anybody help me solve this problem?
implementation
{$R *.dfm}
{$R MyPic.RES}
procedure TForm_Main.Button_PrintClick(Sender: TObject);
Var
MyPic: TBitMap;
: TResourceStream;
begin
try
MyPic := TBitMap.Create;
ResStream := TResourceStream.CreateFromID(hinstance, 1, RT_RCDATA);
MyPic.LoadfromStream(ResStream);
MyPic.Canvas.Draw(15,15, MyPic);
finally
MyPic.Free;
end;
end;
The program Compiles but fails on Run with the following error message on the highlighted line:
“Project TestPrint.exe raised exception class EResNotFound with Message Resource 1 not found.”
Can anybody help me solve this problem?