image2.Canvas.Rectangle(0,0,image1.Width,image1.Height);
with image1.Canvas do
begin
brush.color:= cllime;
pen.Color:=clblue;
font.Name:='Courier';
font.Size:=8;
for i:= 1 to n do
for j:=1 to n do
if (a[i,j]<>0) and (a[i,j]<900) then
begin
pen.Width:=1;
moveto(vx[i]+7,vy[i]+7);
lineto(vx[j]+7,vy[j]+7);
brush.color:= clwhite;
textout(round((vx[i]+vx[j]+4)/2),round((vy[i]+vy[j]+1)/2),inttostr(a[i,j]));
end;
brush.color:= cllime;
for i:= 1 to n do
begin
font.Size:=1;
rectangle(vx[i],vy[i],vx[i]+15,vy[i]+15);
textout(vx[i]+4,vy[i]+1,inttostr(i));
end;
end;
with image2.Canvas do
begin
brush.color:= clLime;
pen.Color:=clblue;
font.Name:='Courier';
font.Size:=8;
for i:= 1 to n do
for j:=1 to n do
if (ar[i,j]<>0) and (ar[i,j]<900) then
begin
pen.Width:=1;
moveto(vx[i]+7,vy[i]+7);
lineto(vx[j]+7,vy[j]+7);
brush.color:= clwhite;
textout(round((vx[i]+vx[j]+4)/2),round((vy[i]+vy[j]+1)/2),inttostr(ar[i,j]));
end;
brush.color:= cllime;
for i:= 1 to n do
begin
font.Size:=1;
rectangle(vx[i],vy[i],vx[i]+15,vy[i]+15);
textout(vx[i]+4,vy[i]+1,inttostr(i));
end; end; end;
procedure TForm1.SpeedButton7Click(Sender: TObject);
var
i:integer;
begin
for i:= 1 to n do
begin
sg.ColCount:=n+1;
sg.Rowcount:=n+1;
sr.ColCount:=n+1;
sr.Rowcount:=n+1;
sg.Cells[0,i]:=inttostr(i);
sr.Cells[0,i]:=inttostr(i);
sg.Cells[i,0]:=inttostr(i);
sr.Cells[i,0]:=inttostr(i); end;
for i:= 1 to n do
for j:= 1 to n do
begin
ar[i,j]:=0;
end;
end;
procedure TForm1.Image2DblClick(Sender: TObject);
begin
timer1.Enabled:=true;
end;
procedure TForm1.SpeedButton8Click(Sender: TObject);
begin
for i:= 1 to n do
begin
vx[i]:=random(470);
vy[i]:=random(230);
end; end;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
vx[idown]:=x;
vy[idown]:=y;
idown:=idown+1;
image1.Canvas.brush.color:= cllime;
image1.Canvas.pen.Color:=clblue;
image1.Canvas.Rectangle(x-1,y-1,x+1,y+1);
end;
procedure TForm1.Image2Click(Sender: TObject);
begin
image1.Canvas.brush.color:= clwhite;
image1.Canvas.pen.Color:=clwhite;
image2.Canvas.brush.color:= clwhite;
image2.Canvas.pen.Color:=clwhite;
image1.Canvas.Rectangle(0,0,image1.Width,image1.Height);
image2.Canvas.Rectangle(0,0,image1.Width,image1.Height); timer1.Enabled:=false;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
n:= strtoint(edit1.text);
speedbutton7.Click;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
var i:integer;
begin
if MessageDlg('Завершитьработу',mtConfirmation,[mbyes,mbno],0) = mrYes then begin
AlphaBlend:=true;
i:=255;
while i>0 do begin
AlphaBlendValue:=i;
Application.ProcessMessages;
dec(i,1);
end;close;end;end;
procedure TForm1.FormShow(Sender: TObject);
begin
Edit1.SetFocus;
end;
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
form2.show;
end;
procedure TForm1.sgClick(Sender: TObject);
var i,j:integer;
begin
for i:= 1 to n do
for j:= 1 to n do
begin
sg.Cells[i,j]:=sg.Cells[j,i];
end;
end;
procedure TForm1.srClick(Sender: TObject);
var i,j:integer;
begin
for i:= 1 to n do
for j:= 1 to n do
begin
sr.Cells[i,j]:=sr.Cells[j,i];
end; end; end.
Приложение Б: исходные файлы