
23.05.2011, 19:52
|
Прохожий
|
|
Регистрация: 23.05.2011
Сообщения: 9
Репутация: 10
|
|
продолжение
Код:
//Размер уменьшить
procedure TForm1.N12Click(Sender: TObject);
begin
a:=Form1.Height;
b:=Form1.Width;
Form1.Height:=a-10;
Form1.Width:=b-10;
end;
//Размер по умолчанию
procedure TForm1.N13Click(Sender: TObject);
begin
Form1.Height:=630;
Form1.Width:=655;
end;
//Создать
procedure TForm1.N14Click(Sender: TObject);
begin
//Количество столбцов и строк в таблице
IF ((Edit1.Text='')or(StrToInt(Edit1.T ext)<=4)or(StrToInt(Edit1.Text)>40) ) THEN
ShowMessage('Неправильно введены события (min=5, а max=40)')
ELSE
begin
Label3.Caption:='Введите продолжительность путей, учитывая направление - от строк к столбцам';
Label3.Width:=465;
Label3.Alignment:=taCenter;
N18.Enabled:=True;
N17.Enabled:=True;
N6.Enabled:=True;
BitBtn10.Enabled:=True;
BitBtn6.Enabled:=True;
BitBtn4.Enabled:=True;
n:=StrToInt(Edit1.Text);
//Возможность тестирования для графа с 7 вершинами
IF n=7 THEN begin
N11.Enabled:=True;
N17.Enabled:=True;
N6.Enabled:=True;
BitBtn5.Enabled:=True;
end;
IF n=8 THEN begin
N11.Enabled:=True;
N17.Enabled:=True;
N6.Enabled:=True;
BitBtn5.Enabled:=True;
end;
IF n=14 THEN begin
N11.Enabled:=True;
N17.Enabled:=True;
N6.Enabled:=True;
BitBtn5.Enabled:=True;
end;
IF n>25 THEN
Form1.WindowState:=wsMaximized;
StringGrid1.ColCount:=n+1;
StringGrid1.RowCount:=n+1;
StringGrid1.Height:=(n+2)*25;
StringGrid1.Width:=(n+2)*25;
StringGrid1.Visible:=True;
Form1.Height:=StringGrid1.Height+25 0;
Form1.Width:=StringGrid1.Width+250;
StringGrid1.Cells[0,0]:='i';
Form1.Position:=poScreenCenter;
IF StringGrid1.Left-n*5>0 THEN
StringGrid1.Left:=StringGrid1.Left-n*5
ELSE
StringGrid1.Left:=0;
Label3.Enabled:=True;
Edit1.Visible:=False;
FOR i:=1 TO n DO
begin
StringGrid1.Cells[0,i]:=inttostr(i);
StringGrid1.Cells[i,0]:=inttostr(i);
StringGrid2.Cells[0,i]:=inttostr(i);
end;
end;
end;
//Ввод числа вершин
procedure TForm1.N15Click(Sender: TObject);
begin
//Возможность тестирования для графа с 7 вершинами
Form1.WindowState:=wsNormal;
Form1.Height:=140;
Form1.Width:=440;
IF n=7 THEN begin
N11.Enabled:=True;
N17.Enabled:=True;
BitBtn5.Enabled:=True;
end;
//Возможность тестирования для графа с 8 вершинами
IF n=8 THEN begin
N11.Enabled:=True;
N17.Enabled:=True;
BitBtn5.Enabled:=True;
end;
//Возможность тестирования для графа с 14 вершинами
IF n=14 THEN begin
N11.Enabled:=True;
N17.Enabled:=True;
BitBtn5.Enabled:=True;
end;
StringGrid1.Left:=218;
Form1.Height:=140;
Form1.Width:=440;
Form1.WindowState:=wsNormal;
Form1.Position:=poScreenCenter;
Label3.Height:=24;
Label3.Width:=269;
StringGrid1.Visible:=False;
StringGrid2.Visible:=False;
Label3.Caption:='Введите количество событий';
Edit1.Visible:=True;
Edit1.SetFocus;
Edit1.Text:='';
FOR i:=1 TO StringGrid1.ColCount DO
FOR j:=1 TO StringGrid1.RowCount DO
StringGrid1.Cells[i,j]:='';
FOR i:=1 TO StringGrid2.ColCount DO
FOR j:=1 TO StringGrid2.RowCount DO
StringGrid2.Cells[i,j]:='';
Label3.Enabled:=True;
end;
|