procedure GetPokemon(Pokemon : TPokemon; Image : TImage);
var
Bitmap : TBitmap;
x, y : Integer;
ResStr : TResourceStream;
begin
ResStr := TResourceStream.Create(HInstance, '
Pokedex', RT_RCDATA);
try
Pokemon_Pictures.PNGButton1.ImageNormal.LoadFromStream(ResStr);
finally
ResStr.Free;
end;
Pokemon_Pictures := TPokemon_Pictures.Create(Application);
try
Bitmap := TBitmap.Create;
try
Bitmap.Assign(Pokemon_Pictures.PNGButton1.ImageNormal.Canvas);
Pokemon_Pictures.Image1.Picture.Bitmap := Bitmap;
if (Pokemon>=Bisasam)
and (Pokemon<=Arceus)
then
begin
y := Ord(Pokemon)
div 25;
x := Ord(Pokemon)
Mod 25;
Image.Canvas.CopyRect(rect(0, 0, 80, 80), BitMap.Canvas, rect(x*80,y*80, (x+1)*80,(y+1)* 80));
end
else
if Pokemon = Arceus
then Image.Canvas.CopyRect(rect(0, 0, 80, 80), BitMap.Canvas, rect(1520, 1080, 17*80, 17*80))
else
raise Exception.Create('
Angefordertes Pokemon konnte nicht gefunden werden!');
finally
Bitmap.Free;
end;
finally
Pokemon_Pictures.Free;
end;
end;