Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,ExtCtrls, Spin;
type
TMyShape=class(TShape)
private
Farbe:
String;
end;
type
TForm1 =
class(TForm)
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
procedure ShapeClick(Sender:TObject);
procedure Bauen;
end;
var
Form1: TForm1;
StartX, StartY: Integer;
Spalten,Reihen:integer;
MyShape:
array[1..225]
of TMyShape;
implementation
{$R *.DFM}
procedure ShapeClick(Sender:TObject);
begin
end;
procedure Bauen;
var i,x:integer;
begin
Spalten:= form1.Spinedit2.value;
Reihen:= form1.Spinedit1.value;
for x:= 1
to Reihen
do begin
for i:=1
to Spalten
do begin
MyShape[i] := TMyShape.Create(Form1);
with MyShape[i]
do begin
Parent := Form1;
Height := 15;
Width := 15;
Shape:=strectangle;
Left := 120+22*i;
Top := x*22;
MyShape[i].OnClick:=ShapeClick;
end;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Bauen;
end;
end.
Unit1.pas[66]:Inkompatible Typen: Methodenzeiger und reguläre Procedure
Unit1.pas[31]:Ungenügende Forward Externel Deklaration 'Form1.Shape1.CLick'
Unit1.pas[32]:Ungenügende Forward Externel Deklaration 'Form1.Bauen'