Поиск пути
Таблица 12.1. Значения свойств компонента stringGrid1.
Свойство | Значение |
---|---|
Name | StringGrid1 |
ColCount | 11 |
RowCount | 11 |
FixedCols | 1 |
FixedRows | 1 |
Options.goEditing | TRUE |
DefaultColWidth | 16 |
DefaultRowHeight | 14 |
Текст программы приведен в листинге 12.5.
Листинг 12.5. Поиск маршрута.
unit road_; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCTRLs, Grids; type TForml = class (TForm) StringGrid1: TStringGrid; Edit1: TEdit; Edit2: TEdit; Label1: TLabel; Label2: TLabel; Label3: TLabel; Button1: TButton; Label4: TLabel; procedure FormActivate(Sender: TObject); procedure ButtonlClickfSender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForml.FormActivate(Sender: TObject); var i:integer; begin // нумерация строк for i: = 1 to 10 do StringGrid1.Cells[0,i]: = IntToStr(i); // нумерация колонок for i: = l to 10 do StringGrid1.Cells[1.0]: = IntToStr(i); // описание предопределенной карты StringGrid1.Cells[1.2]: = '1' StringGrid1.Cells[2,l]: = '1' StringGrid1.Cells[1.3]: = '1' StringGrid1.Cells[3.1]: = '1' StringGrid1.Cells[1.4]: = '1' StringGrid1.Cells[4.1]: = '1' StringGrid1.Cells[3.7]: = '1' StringGrid1.Cells[7.3]: = '1' StringGrid1.Cells[4.6]: = '1' StringGrid1.Cells[6.4]: = '1' StringGrid1.Cells[5.6]: = '1' StringGrid1.Cells[6.5]: = '1' StringGrid1.Cells[5.7]: = '1' StringGrid1.Cells[7.5]: = '1' StringGrid1.Cells[6.7]: = '1' StringGrid1.Cells[7.6]: = '1' end;