Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Диссертация_2013_Даулбаева ММ.doc
Скачиваний:
67
Добавлен:
10.03.2016
Размер:
2.34 Mб
Скачать

Продолжение приложения б

l: TLine;

s: string;

begin

if ((i1 < 0) or (i2 < 0) or (i1 = i2)) then

exit;

f := 0;

for index := 0 to fLines.Count-1 do

begin

l := fLines.Items[index];

if (((l.i1 = i1) and (l.i2 = i2)) or

((l.i2 = i1) and (l.i1 = i2)) ) then

begin

f := 1;

break;

end

end;

if (f = 1) then

begin

fLines.Delete( index );

l.Destroy;

end

else

begin

l := TLine.Create;

s := InputBox( 'Введите цену', '', '1' );

l.i1 := i1;

l.i2 := i2;

l.val := StrToInt( s );

fLines.Add( l );

end;

end;

procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

var

i: integer;

begin

Продолжение приложения б

i := IsOver( X,Y );

if (i < 0) then

exit;

if (Button = mbLeft) then

fMouseState := 1

else if (Button = mbRight) then

fMouseState := 2;

fMouseInd := i;

end;

procedure TForm1.Button7Click(Sender: TObject);

var

index, c1, c2: integer;

fig, fig2: TFigure;

l: TLine;

begin

c1 := 0;

c2 := 0;

for index := 0 to fFigures.Count-1 do

begin

fig := fFigures.Items[index];

if (fig.flag = 0) then

inc(c1)

else

inc(c2);

end;

StringGrid1.ColCount := c2 + 2;

StringGrid1.RowCount := c1 + 2;

c1 := 0;

c2 := 0;

for index := 0 to fFigures.Count-1 do

begin

fig := fFigures.Items[index];

if (fig.flag = 0) then

begin

StringGrid1.Cells[1,c1+2] := IntToStr( fig.val );

Продолжение приложения б

fig.p := c1;

inc( c1 );

end

else

begin

StringGrid1.Cells[c2+2,1] := IntToStr( fig.val );

fig.p := c2;

inc( c2 );

end;

end;

for index := 0 to fLines.Count-1 do

begin

l := fLines.Items[index];

fig := fFigures.Items[ l.i1 ];

fig2 := fFigures.Items[ l.i2 ];

if (fig.flag = fig2.flag) then

continue;

if (fig.flag = 0) then

StringGrid1.Cells[ fig2.p+2, fig.p+2 ] := IntToStr( l.val )

else

StringGrid1.Cells[ fig.p+2, fig2.p+2 ] := IntToStr( l.val );

end;

Button2Click( nil );

end;

procedure TForm1.Button3Click(Sender: TObject);

procedure c( x, y: integer; s: string );

begin

StringGrid1.Cells[ x, y ] := s;

end;

begin

StringGrid1.ColCount := 7;

StringGrid1.RowCount := 5;

c( 2, 1, '0' );

c( 3, 1, '0' );

c( 4, 1, '0' );

c( 5, 1, '0' );

c( 6, 1, '0' );

c( 1, 2, '0' );

c( 1, 3, '0' );

c( 1, 4, '0' );

Продолжение приложения б

c( 2, 2, '0' );

c( 3, 2, '0' );

c( 4, 2, '0' );

c( 5, 2, '0' );

c( 6, 2, '0' );

c( 2, 3, '0' );

c( 3, 3, '0' );

c( 4, 3, '0' );

c( 5, 3, '0' );

c( 6, 3, '0' );

c( 2, 4, '0' );

c( 3, 4, '0' );

c( 4, 4, '0' );

c( 5, 4, '0' );

c( 6, 4, '0' );

end;

procedure TForm1.N1Click(Sender: TObject);

begin

Button5Click(Button5);

end;

procedure TForm1.N6Click(Sender: TObject);

begin

Button3Click(Button3);

end;

procedure TForm1.N2Click(Sender: TObject);

begin

Form1.Close;

end;

procedure TForm1.N4Click(Sender: TObject);

begin

Button1Click(Button1);

end;

procedure TForm1.N5Click(Sender: TObject);

begin

Button2Click(Button2);

end;

end.

95