陈
陈君凯
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Button2: TButton;
Panel1: TPanel;
Image1: TImage;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses unit1;
{$R *.DFM}
procedure TForm2.FormCreate(Sender: TObject);
var shaped:array of TShape;
i,j:integer;
q:nodeptr;
begin
for i:=1 to n do
begin
shaped:=TShape.Create(self);
shaped.Parent:=Self;
shaped.Height:=30;
shaped.Width:=30;
shaped.Top:=adj.zb.y1+15;
shaped.Left:=adj.zb.x1-15;
randomize;
shaped.Brush.Color:=rgb(random(255),random(255),random(255));
shaped.Brush.Style:=bsSolid;
randomize;
shaped.Pen.Color:=rgb(random(254),random(254),random(254));
shaped.Pen.Mode:=pmCopy;
shaped.Pen.Style:=psSolid;
shaped.Pen.Width:=1;
shaped.Shape:=stCircle;
Form2.Image1.Canvas.TextOut(adj.zb.x1-20,adj.zb.y1-40,Form1.Edit1.Text);
end;
new(q);
for i:=1 to n do
begin
q:=adj.link;
while q<>nil do
begin
Form2.Canvas.Pen.Color:=clOlive;
Form2.Canvas.Pen.Width:=1;
Form2.Canvas.MoveTo(adj.zb.x1+15,adj.zb.y1);
Form2.Canvas.LineTo(adj[q^.num].zb.x1-15,adj[q^.num].zb.y1);
q:=q^.link
end;
end;
i:=1;
repeat
j:=i+1;
Form2.Canvas.Pen.Color:=clPurple;
Form2.Canvas.Pen.Width:=2;
Form2.Canvas.MoveTo(adj[pre].zb.x1+15,adj[pre].zb.y1);
Form2.Canvas.LineTo(adj[pre[j]].zb.x1-15,adj[pre[j]].zb.y1);
i:=i+1;
until(j=n)
end;
end.
问题出在这一句:
shaped:=TShape.Create(self);
不知为何?望高人不吝赐教
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Button2: TButton;
Panel1: TPanel;
Image1: TImage;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses unit1;
{$R *.DFM}
procedure TForm2.FormCreate(Sender: TObject);
var shaped:array of TShape;
i,j:integer;
q:nodeptr;
begin
for i:=1 to n do
begin
shaped:=TShape.Create(self);
shaped.Parent:=Self;
shaped.Height:=30;
shaped.Width:=30;
shaped.Top:=adj.zb.y1+15;
shaped.Left:=adj.zb.x1-15;
randomize;
shaped.Brush.Color:=rgb(random(255),random(255),random(255));
shaped.Brush.Style:=bsSolid;
randomize;
shaped.Pen.Color:=rgb(random(254),random(254),random(254));
shaped.Pen.Mode:=pmCopy;
shaped.Pen.Style:=psSolid;
shaped.Pen.Width:=1;
shaped.Shape:=stCircle;
Form2.Image1.Canvas.TextOut(adj.zb.x1-20,adj.zb.y1-40,Form1.Edit1.Text);
end;
new(q);
for i:=1 to n do
begin
q:=adj.link;
while q<>nil do
begin
Form2.Canvas.Pen.Color:=clOlive;
Form2.Canvas.Pen.Width:=1;
Form2.Canvas.MoveTo(adj.zb.x1+15,adj.zb.y1);
Form2.Canvas.LineTo(adj[q^.num].zb.x1-15,adj[q^.num].zb.y1);
q:=q^.link
end;
end;
i:=1;
repeat
j:=i+1;
Form2.Canvas.Pen.Color:=clPurple;
Form2.Canvas.Pen.Width:=2;
Form2.Canvas.MoveTo(adj[pre].zb.x1+15,adj[pre].zb.y1);
Form2.Canvas.LineTo(adj[pre[j]].zb.x1-15,adj[pre[j]].zb.y1);
i:=i+1;
until(j=n)
end;
end.
问题出在这一句:
shaped:=TShape.Create(self);
不知为何?望高人不吝赐教