bmp:=TBitmap.Create;
// bmp.Handle:=LoadImage(HINSTANCE,'bmp1',IMAGE_BITMAP,0,0,0);//HINSTANCE
try
bmp.LoadFromFile('testfas.bmp');
except
on EFOpenError do
begin
//ShowMessage('here');
bmp.LoadFromFile('123.bmp');
end;
end;
{
if not(Assigned(bmp)) then
begin
bmp.LoadFromFile('test.bmp');
end;
}
Canvas.StretchDraw(Rect(0,0,100,100),bmp);
//bmp.Canvas.s
bmp.Free;
异常处理在exe打开时有效