unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls,pngextra,pngimage,pnglang,zlibpas;
type
TForm2 =
class(TForm)
procedure init;
procedure Bildzeigen(Namebild:
string; Bild:
string; x3:integer; y3:integer);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
TYPE Tfeld =
record
Bild: TImage;
Name:
String;
end;
var feld:
array [1..8,1..8]
of Tfeld;
var x,y : integer;
{$R *.dfm}
Procedure TForm2.Bildzeigen(Namebild:
string;Bild:
string; x3:integer; y3:integer);
begin
feld[x3,y3].
Name := Namebild;
feld[x3,y3].Bild := Timage.create(Form2);
feld[x3,y3].Bild.parent := Form2;
feld[x3,y3].Bild.top := x3*40;
feld[x3,y3].Bild.left := y3*40;
feld[x3,y3].Bild.Picture.LoadFromFile(Bild);
feld[x3,x3].Bild.visible:=true;
end;
procedure TForm2.init;
begin
for x:=1
to 8
do
begin
for y:=1
to 8
do
begin
if (x+y)
mod 2=0
then
begin
Bildzeigen('
schwarzefleache', '
images/schwarz1.png', x,y)
end
else
Bildzeigen('
weißefleache', '
images/weiß1.png', x,y);
end;
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
randomize;
Form2.DoubleBuffered:=True;
init;
end;
end.