unit Unit8;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TFeld =
class(Tobject)
position : Tpoint;
private
public
end;
TForm8 =
class(TForm)
Label1: TLabel;
Image1: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
Felder :
array[0..64]
of TFeld;
procedure position();
procedure Zeichnen();
end;
var
Form8: TForm8;
implementation
{$R *.dfm}
procedure TForm8.Button1Click(Sender: TObject);
begin
zeichnen();
end;
procedure TForm8.FormCreate(Sender: TObject);
begin
position();
end;
procedure Tform8.position;
var
i,b,c : integer;
begin
for I := 0
to length(Felder)
do
begin
felder[i] := Tfeld.create;
felder[i].position.Y := I
div 8;
b := I
div 8;
c := b*8;
felder[i].position.X := i - c;
end;
end;
procedure TForm8.Zeichnen;
var
i : integer;
schwarz : boolean;
begin
schwarz := false;
for I := 0
to length(Felder)
do
begin
if schwarz
then
begin
image1.Canvas.Brush.Color := clblack;
image1.Canvas.Rectangle(felder[i].position.X*50,felder[i].position.Y*50,felder[i].position.X*50+50, felder[i].position.Y*50+50);
if not (I
mod 8 = 0)
then
begin
schwarz := false;
end
else
begin
showmessage(inttostr(i));
end;
end
else
begin
image1.Canvas.Brush.Color := clwhite;
image1.Canvas.Rectangle(felder[i].position.X*50,felder[i].position.Y*50,felder[i].position.X*50+50, felder[i].position.Y*50+50);
if not (I
mod 8 = 0)
then
begin
schwarz := true;
end
else
begin
showmessage(inttostr(i));
end;
end;
end;
end;
end.