Язык
|
Объектно-ориентированный
язык программирования
|
Компоненты ADO
|
Удобство
|
Наличие
лицензии
|
Delphi
|
+
|
+
|
+
|
+
|
Visual
C++
|
+
|
-
|
+
|
-
|
Turbo
Basic
|
-
|
-
|
-
|
-
|
Обоснование выбора языка программирования приведены в таблице
1. Главными причинами данного выбора стали наличие лицензии и наличие ADO компонентов, необходимы
для работы с Базой Данных Microsoft Office Access 2003.
Объектно-ориентированные особенности языка:
Инкапсуляция
<#"550624.files/image001.gif">
Рисунок 2- Вторая Нормальная Форма
Рисунок 3 - Третья Нормальная Форма
Приложение Б.
Входные формы.
Рисунок 4 Входная форма начальных параметров поля
Рисунок 5 Входная форма начальных параметров мобильных узлов, их
количества и количества возникновения сетей
Приложение В.
Выходные формы
Рисунок 6 Выходная форма вывода результата моделирования связи
мобильных узлов
Приложение Г.
беспроводной мобильный программирование сеть
Инструкция пользователя
Рисунок 7 - Главное Меню - Дополнительно
Рисунок 8 - Начальные параметры
Рисунок 9 - Главное Меню - Файл
Рисунок 10 - Главная форма (Обрезанная)
Рисунок 11 - Выпадающее меню при нажатие Правой Кнопкой Мыши (ПКМ)
на изображение
Рисунок 12 Главное меню - База даныых
Рисунок 13 Создание новой БД
Рисунок 14 Окно выбора файла
Рисунок 15 - Отображение Базы Данных
Приложение Д
Листинг программы
(Unit1).Unit1;, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,, ExtCtrls, StdCtrls, Grids, XPMan, Buttons, Menus, ComCtrls;//,
Keyboard;= class(TForm): TImage;: TStringGrid;: TButton;: TButton;: TButton;:
TXPManifest;: TTimer;: TLabel;: TLabeledEdit;: TButton;: TCheckBox;:
TStringGrid;: TLabeledEdit;: TMainMenu;: TMenuItem;: TMenuItem;: TMenuItem;:
TMenuItem;: TMenuItem;: TMenuItem;: TMenuItem;: TMenuItem;: TMenuItem;:
TMenuItem;: TMenuItem;: TPopupMenu;: TMenuItem;: TMenuItem;: TMenuItem;:
TStringGrid;: TMenuItem;: TMenuItem;: TGroupBox;: TLabeledEdit;: TLabeledEdit;:
TLabel;: TLabel;: TLabel;: TEdit;: TLabel;: TEdit;: TEdit;: TLabel;: TEdit;:
TLabel;: TButton;: TButton;: TLabel;: TProgressBar;: TMenuItem;: TMenuItem;:
TMenuItem;: TOpenDialog;: TPanel;: TLabeledEdit;: TButton;:
TButton;FormCreate(Sender: TObject);Button3Click(Sender:
TObject);FormCloseQuery(Sender: TObject; var CanClose: Boolean);Timer1Timer(Sender:
TObject);Button1Click(Sender: TObject);Button4Click(Sender:
TObject);LabeledEdit1KeyPress(Sender: TObject; var Key:
Char);Button2Click(Sender: TObject);CheckBox1Click(Sender:
TObject);FormCanResize(Sender: TObject; var NewWidth,: Integer; var Resize: Boolean);Button2MouseDown(Sender:
TObject; Button: TMouseButton;: TShiftState; X, Y: Integer);N16Click(Sender:
TObject);N9Click(Sender: TObject);Button6Click(Sender:
TObject);Button5Click(Sender: TObject);N11Click(Sender:
TObject);Edit3KeyPress(Sender: TObject; var Key: Char);N17Click(Sender:
TObject);N18Click(Sender: TObject);N19Click(Sender:
TObject);Button7Click(Sender: TObject);Button8Click(Sender:
TObject);StringGrid1KeyPress(Sender: TObject; var Key: Char);
{ Private declarations }
{ Public declarations };
var
Form1: TForm1;
// i:Integer;//переменная для циклов
k,ks:Integer;//количество узлов,Количество возникновения сетей
x,y:Integer;// положение узла
x1,y1:Integer;//направление узла
v:real;//Integer;//скорость:Integer;//радиус
// S1:Integer;//1% площади прямоугольникa
// S2:array of Integer;//площадь зоны действия
узла,TimeEnd,Data: String; // Начало и конец испытания: array of array of
Byte;//Массив всех связей: array of Byte; // массив отмеченных связей 1 узла
p:Integer;//позиция текущей записи образовавщейся сети
flag:Boolean;//флаг образования сети:array [0..5]
of Integer;:Real; //количество квадратных
метров в 1 пикселе
// LengthPath:integer;//длина путиUnit2, Math;
{$R *.dfm}TForm1.FormCreate(Sender: TObject);
//var i:Real;:=False;
//i:=1000/3;
//Label1.Caption:=FloatToStr(RoundTo(i,-2));.Caption:='Начать';
//S1:=Round((Image1.Width*Image1.Height)/100);Click(Sender);.InitialDir:=ExtractFilePath(Application.ExeName)+'БД\';[0]:=StrToInt(LabeledEdit3.Text);[1]:=StrToInt(LabeledEdit4.Text);[2]:=StrToInt(Edit1.Text);[3]:=StrToInt(Edit2.Text);[4]:=StrToInt(Edit3.Text);[5]:=StrToInt(Edit4.Text);
//ShowMessage(IntToStr(Form1.Height)+'
'+IntToStr(Monitor.Height));.Width:=Monitor.Width+10;.Height:=Monitor.Height;Click(Sender);.Canvas.Brush.Style:=bsSolid;.Canvas.Pen.Color:=RGB(255,255,255);
//
Image1.Canvas.Brush.Color:=RGB(255,255,255);.Canvas.Rectangle(0,0,Image1.Width,Image1.Height);
// при изменение экрана
Form1.Width:=680;
Form1.Height:=575;Click(Sender);
//StringGrid2.Cells[0,0]:='Id';.Cells[0,0]:='Путь';.Cells[1,0]:='Соединение';.Cells[2,0]:='Разрыв';.Cells[3,0]:='Жизнь';.DefaultColWidth:=60;.Cells[0,0]:='№';.Cells[1,0]:='X';.Cells[2,0]:='Y';.Cells[3,0]:='X1';.Cells[4,0]:='Y1';.Cells[5,0]:='V';.Cells[6,0]:='R';;TForm1.Button3Click(Sender:
TObject);.Close;;TForm1.FormCloseQuery(Sender: TObject; var CanClose:
Boolean);i:integer;MessageDlg('Вы уверены,что хотите
выйти?',mtInformation,[mbYes,MbNo],0)=mrNo then:=False
// S2:=nil;i:=0 to k-1
do[i]:=nil;:=nil;;;InfoBeginPatch(i:integer);j,l:integer;,fl:boolean;
//str:String;
begin
// проверка на наличие связи
fl:=true;Length(Net)>1
thenConnect[Net[Length(Net)-1],i]<>1 then:=false;
// Form1.Timer1.Enabled:=False;
//
ShowMessage(IntToStr(Net[Length(Net)-2]+1)+'<->'+IntToStr(i+1));
// Form1.Timer1.Enabled:=true;;fl then(Net,length(Net)+1);[length(Net)-1]:=i;j:=0
to k-1 do:=false;l:=0 to length(Net)-1 doj=Net[l] then:=true;;f then;
{str:='';l:=0 to Length(net)-2
do:=str+IntToStr(Net[l]+1)+'<->';:=str+IntToStr(Net[Length(Net)-1]+1);.Timer1.Enabled:=false;(str);.Timer1.Enabled:=true;}
// elseConnect[i,j]=1
then(j);;;;AddDate();i,j:Integer;,w:Real;:TTime;
//выситывание среднего времени жизни пути
j:=0;:=StrToTime('00:00:00');p>=1 theni:=1 to
p doForm1.StringGrid2.Cells[2,i]=''
then;:=SrTime+StrToTime(Form1.StringGrid2.Cells[3,i]);:=j+1;;j>0 then
SrTime:=SrTime/j;
//запись в данных таблицу Испытания
Form1.ProgressBar1.Max:=2+Form1.StringGrid3.RowCount+Form1.StringGrid2.RowCount;.ProgressBar1.Min:=0;.ProgressBar1.Position:=0;.ProgressBar1.Visible:=True;.ADOTable1.Last;.ADOTable1.Insert;.ADOTable1.FieldByName('Дата').AsString:=Data;.ADOTable1.FieldByName('Начало').AsString:=TimeStart;.ADOTable1.FieldByName('Окончание').AsString:=TimeEnd;.ADOTable1.FieldByName('Узлов').AsInteger:=k;.ADOTable1.FieldByName('Совпадений').AsInteger:=j;.ADOTable1.FieldByName('Среднее
время
жизни').AsString:=TimeToStr(SrTime);.ADOTable1.Post;.ADOTable1.Refresh;.ADOTable1.Last;.ProgressBar1.Position:=1;
else
begin
MessageDlg('Не было ни одного полного цикла жизни
сети.'+#13+'Данные об испытание не будут сохранены в Базу Данных!',mtInformation,[mbOK],0);
Exit;
end;
//запись в таблицу Начальные параметры
for i:=0 to Form1.StringGrid3.RowCount-1
do.ADOTable2.Last;.ADOTable2.Insert;.ADOTable2.FieldByName('Испытание').AsInteger:=Form2.ADOTable1.FieldByName('Id').AsInteger;.ADOTable2.FieldByName('Узел').AsInteger:=i+1;
:=RoundTo(StrToInt(Form1.StringGrid3.Cells[1,i])*sqrt(Pix),-2);:=RoundTo(StrToInt(Form1.StringGrid3.Cells[2,i])*sqrt(Pix),-2);.ADOTable2.FieldByName('Положение').AsString:=FloatToStr(q)+';'+FloatToStr(w);:=RoundTo(StrToInt(Form1.StringGrid3.Cells[3,i])*sqrt(Pix),-2);:=RoundTo(StrToInt(Form1.StringGrid3.Cells[4,i])*sqrt(Pix),-2);.ADOTable2.FieldByName('Направление').AsString:=FloatToStr(q)+';'+FloatToStr(w);
// q:=RoundTo(StrToInt(Form1.StringGrid3.Cells[5,i])*Pix,-2);.ADOTable2.FieldByName('Скорость').AsString:=Form1.StringGrid3.Cells[5,i];
//
q:=RoundTo(StrToInt(Form1.StringGrid3.Cells[6,i])*Pix,-2);.ADOTable2.FieldByName('Радиус').AsString:=Form1.StringGrid3.Cells[6,i];//FloatToStr(q);.ADOTable2.Post;.ADOTable2.Refresh;.ProgressBar1.Position:=Form1.ProgressBar1.Position+1;;
// Запись в таблицу Параметры поля
// Запись в таблицу Соединенияi:=1 to
Form1.StringGrid2.RowCount-1 doForm1.StringGrid2.Cells[2,i]=''
then;.ADOTable3.Last;.ADOTable3.Insert;.ADOTable3.FieldByName('Испытание').AsInteger:=Form2.ADOTable1.FieldByName('Id').AsInteger;.ADOTable3.FieldByName('Путь').AsString:=Form1.StringGrid2.Cells[0,i];.ADOTable3.FieldByName('Соединение').AsString:=Form1.StringGrid2.Cells[1,i];.ADOTable3.FieldByName('Разрыв').AsString:=Form1.StringGrid2.Cells[2,i];.ADOTable3.FieldByName('Жизнь').AsString:=Form1.StringGrid2.Cells[3,i];.ADOTable3.Post;.ADOTable3.Refresh;.ProgressBar1.Position:=Form1.ProgressBar1.Position+1;.ProgressBar1.Visible:=False;;;LifePath(j:integer);l,x0,y0,r1,x2,y2:integer;:byte;
str:string;l:=j+1 to k do
//считывание
параметров:=StrToInt(Form1.StringGrid1.Cells[6,j]);:=StrToInt(Form1.StringGrid1.Cells[1,j]);:=StrToInt(Form1.StringGrid1.Cells[2,j]);
//изменение параметров для вычислений в соответствие с
радиусом
if r1>StrToInt(Form1.StringGrid1.Cells[6,l])
then:=StrToInt(Form1.StringGrid1.Cells[6,l]);:=StrToInt(Form1.StringGrid1.Cells[1,l]);:=StrToInt(Form1.StringGrid1.Cells[2,l]);:=x2;:=y2;:=StrToInt(Form1.StringGrid1.Cells[1,l]);:=StrToInt(Form1.StringGrid1.Cells[2,l]);;
//проверка
соединения(sqr(x2-x0)+sqr(y2-y0))<=sqr(r1/sqrt(Pix))
then[j-1,l-1]:=1;[l-1,j-1]:=1;
// Form1.StringGrid2.Cells[j,l]:='1';
// Form1.StringGrid2.Cells[l,j]:='1';
//прорисовка
соединения.Image1.Canvas.Brush.Style:=bsSolid;.Image1.Canvas.Pen.Color:=RGB(0,0,255);.Image1.Canvas.Pen.Width:=2;.Image1.Canvas.MoveTo(x0,y0);.Image1.Canvas.LineTo(x2,y2);.Image1.Canvas.Pen.Width:=1;[j-1,l-1]:=0;[l-1,j-1]:=0;
// Form1.StringGrid2.Cells[j,l]:='0';
// Form1.StringGrid2.Cells[l,j]:='0';;;
//проверка сетиflag then//проверка на разрыв
сетиl:=0 to Length(Net)-2 doConnect[Net[l],Net[l+1]]=0
then:=false;.StringGrid2.Cells[2,p]:=TimeToStr(Time);.StringGrid2.Cells[3,p]:=TimeToStr((StrToTime(Form1.StringGrid2.Cells[1,p])-Time)*20);
// if Form1.StringGrid2.Cells[4,p]='' then
// Form1.StringGrid2.Cells[4,p]:='00:00:00';p=ks
then.Button1.Enabled:=False;.Button4.Enabled:=False;.Button2.Enabled:=True;.LabeledEdit1.Enabled:=True;.LabeledEdit2.Enabled:=True;.Timer1.Enabled:=false;:=TimeToStr(Time);.CheckBox1.Enabled:=True;
//GropuBox.LabeledEdit3.Enabled:=True;.LabeledEdit4.Enabled:=True;.Edit1.Enabled:=True;.Edit2.Enabled:=True;.Edit3.Enabled:=True;.Edit4.Enabled:=True;.Button5.Enabled:=True;
//ЗАПИСЬ В БДForm1.N7.Enabled then;('Ошибка при
добавление данных в БД',mtError,[mbCancel],0);;;;//проверка на появление
сетиl:=0 to k-1 do:=0;j:=0 to k-1 do:=s+Connect[l,j];:=s-2;s=1 then:=nil;
{Form1.Timer1.Enabled:=false;('Begin
'+IntToStr(l+1));.Timer1.Enabled:=true;}(l); //йцукенLength(Net)=k
then:=true;y0:=0 to Length(net)-2
do:=str+IntToStr(Net[y0]+1)+'<->';:=str+IntToStr(Net[Length(Net)-1]+1);x0:=1
to Form1.StringGrid2.RowCount-1 doForm1.StringGrid2.Cells[0,x0]='' then:=x0;.Label8.Caption:='Количество
образовавшихся сетей:
'+IntToStr(p);.StringGrid2.Cells[0,p]:=str;.StringGrid2.Cells[1,p]:=TimeToStr(Time);:='';;;;;;
//концы =D;;;TForm1.Timer1Timer(Sender:
TObject);i,rPix,vPix:integer;.Canvas.Brush.Style:=bsSolid;.Canvas.Pen.Color:=RGB(255,255,255);
//
Image1.Canvas.Brush.Color:=RGB(255,255,255);.Canvas.Rectangle(0,0,Image1.Width,Image1.Height);i:=1
to k do
//считывание информации из таблицы
x:=StrToInt(StringGrid1.Cells[1,i]);
y:=StrToInt(StringGrid1.Cells[2,i]);:=StrToInt(StringGrid1.Cells[3,i]);:=StrToInt(StringGrid1.Cells[4,i]);:=StrToFloat(StringGrid1.Cells[5,i]);:=StrToInt(StringGrid1.Cells[6,i]);
//изменение положения
узла:=Round(v/sqrt(Pix)*1000/Timer1.Interval);not((x<x1+vPix)and(x>x1-vPix))thenx<x1
then:=x+vPix:=x-vPix;not((y>y1-vPix)and(y<y1+vPix)) theny<y1
then:=y+vPix:=y-vPix;.Cells[1,i]:=IntToStr(x);.Cells[2,i]:=IntToStr(y);(x<x1+vPix)and(x>x1-vPix)and(y>y1-vPix)and(y<y1+vPix)
then
x:=x1;
y:=y1;
//смена направления движения
Randomize;:=random(Image1.Width);:=random(Image1.Height);
//смена
скорости:=RoundTo(random*(Par[5]-Par[4])+Par[4]-0.1,-1)+0.1;.Cells[3,i]:=IntToStr(x1);.Cells[4,i]:=IntToStr(y1);.Cells[5,i]:=FloatToStr(v);;
//прорисовка узла i
//
Image1.Canvas.Pen.Width:=1;.Canvas.Brush.Style:=bsSolid;.Canvas.Brush.Color:=RGB(255,0,0);.Canvas.Pen.Color:=RGB(255,0,0);.Canvas.Ellipse(x-2,y-2,x+2,y+2);.Canvas.Brush.Style:=bsClear;.Canvas.TextOut(x,y-10,IntToStr(i));.Canvas.Pen.Color:=RGB(0,255,0);
//
rPix:=Round(sqr(r)/Pix);:=Round(r/sqrt(Pix));.Canvas.Ellipse(x-rPix,y-rPix,x+rPix,y+rPix);;i:=1
to k-1 do(i);(p=ks) and (Timer1.Enabled=false)
then.Label1.Caption:=Form1.Label1.Caption+#13+'Конец: ' +
TimeEnd;;TForm1.Button1Click(Sender: TObject);j,i:Integer;:='';:='';:='';i:=1
to StringGrid1.RowCount-1 doj:=0 to StringGrid1.ColCount-1 donot(j=5)
then(StringGrid1.Cells[j,i]);
MessageDlg('Данные в таблице введены неверно!',mtError,[mbOk],0);
Exit;;
//
CheckBox1.Enabled:=False;.Caption:='Стоп';.Caption:='Стоп';.Caption:='Стоп';Button1.Caption='Начать'
then:=TimeToStr(Time);:=DateToStr(Date);.Caption:='Начало: '+Data+'
'+TimeStart;.Enabled:=False;
//
Label1.Visible:=True;:=False;:=StrToInt(LabeledEdit2.Text);.RowCount:=ks+1;i:=1
to StringGrid2.RowCount-1 doj:=0 to StringGrid2.ColCount-1
do.Cells[j,i]:='';ks>4 then.Width:=266
StringGrid2.Width:=247;
end;
//чтоб нельзя было использовать паузу
Button1.Enabled:=False;.Enabled:=False;
Timer1.Enabled
then.Caption:='Продолжить';.Enabled:=false;.Enabled:=True;.Caption:='Пауза';.Enabled:=true;.Enabled:=False;.Checked:=False;Click(Sender);;;TForm1.Button4Click(Sender:
TObject);i:integer;.Enabled:=False;.Enabled:=False;.Enabled:=True;.Enabled:=False;.Enabled:=False;.Enabled:=False;.Enabled:=False;.Enabled:=True;.Enabled:=True;.Enabled:=True;.Enabled:=True;
//GroupBox.Enabled:=True;.Enabled:=True;.Enabled:=True;.Enabled:=True;.Enabled:=True;.Enabled:=True;.Enabled:=True;Button4.Caption='Очистить'
then.Caption:='Стоп';.Caption:='Стоп';i:=1 to StringGrid1.RowCount-1
do.Cells[0,i]:='';.Cells[1,i]:='';.Cells[2,i]:='';.Cells[3,i]:='';.Cells[4,i]:='';.Cells[5,i]:='';.Cells[6,i]:='';;.Caption:='Стоп';;;.Enabled:=false;:=TimeToStr(Time);.Caption:=Label1.Caption+#13+'Конец:
' + TimeEnd;1.Enabled:=True;
// MessageDlg('Преждевременная остановка
испытания!'+#13+'Полученные данные не будут сохранены!',mtInformation,[mbOk],0);
try
if N7.Enabled then
if MessageDlg('Преждевременная остановка
испытания!'+#13+'Сохранить полученные данные',mtConfirmation,[mbYes,mbNo],0)=mrYes then
AddDate;
Except
MessageDlg('Ошибка при добавление данных в БД',mtError,[mbCancel],0)
end;//}:='';:='';:='';;TForm1.LabeledEdit1KeyPress(Sender:
TObject; var Key: Char);((key<'0') or (key>'9')) and (key<>#8)
then:=#0;;TForm1.Button2Click(Sender:
TObject);i,rPix:integer;StrToInt(LabeledEdit1.Text)>50 then('Максимальное количество
узлов 50',mtInformation,[mbOk],0);;;StrToInt(LabeledEdit1.Text)<2
then('Минимальное количество узлов 2',mtInformation,[mbOk],0);;;
Button5Click(Sender);
//очитска памяти динамических массивов
// S2:=nil;i:=0 to k-1
do[i]:=nil;:=nil;LabeledEdit1.Text='' then('Введите количество
узлов',mtInformation,[mbOk],0);;;:=StrToInt(LabeledEdit1.Text);k>6
then.Width:=273.Width:=255;.RowCount:=k+1;.RowCount:=k;k>=3 then
// создание массива площадей
// SetLength(S2,k);
// создание массива связей
SetLength(Connect,k);
for i:=0 to k-1 do(Connect[i],k);[i,i]:=2;;
//очистка зоны
проприсовки.Canvas.Brush.Style:=bsSolid;.Canvas.Pen.Color:=RGB(255,255,255);
//
Image1.Canvas.Brush.Color:=RGB(255,255,255);.Canvas.Rectangle(0,0,Image1.Width,Image1.Height);i:=1
to k do
//задание случайных
велечин;:=random(Image1.Width);:=random(Image1.Height);:=random(Image1.Width);:=random(Image1.Height);
//
S2[i-1]:=Round(Par[2]+random(Par[3]-Par[2]));:=Round(Par[2]+random(Par[3]-Par[2]));//Round(sqrt(S2[i-1]/(2*Pi)));:=RoundTo(Par[4]+random*(Par[5]-Par[4]),-1);
//запсиь величин в
таблицу.Cells[0,i]:=IntToStr(i);.Cells[1,i]:=IntToStr(x);.Cells[2,i]:=IntToStr(y);.Cells[3,i]:=IntToStr(x1);.Cells[4,i]:=IntToStr(y1);.Cells[5,i]:=FloatToStr(v);.Cells[6,i]:=IntToStr(r);
//запись начальны
параметров.Cells[0,i-1]:=IntToStr(i);.Cells[1,i-1]:=IntToStr(x);.Cells[2,i-1]:=IntToStr(y);.Cells[3,i-1]:=IntToStr(x1);.Cells[4,i-1]:=IntToStr(y1);.Cells[5,i-1]:=FloatToStr(v);.Cells[6,i-1]:=IntToStr(r);
//прорисовка узла i
// Image1.Canvas.Pen.Width:=1;.Canvas.Brush.Style:=bsSolid;.Canvas.Brush.Color:=RGB(255,0,0);.Canvas.Pen.Color:=RGB(255,0,0);.Canvas.Ellipse(x-2,y-2,x+2,y+2);.Canvas.Brush.Style:=bsClear;.Canvas.TextOut(x,y-10,IntToStr(i));.Canvas.Pen.Color:=RGB(0,255,0);:=Round(r/sqrt(Pix));.Canvas.Ellipse(x-rPix,y-rPix,x+rPix,y+rPix);;.Caption:='';.Enabled:=True;.Enabled:=False;.Caption:='Начать';.Enabled:=True;.Caption:='Очистить';.Enabled:=False;.Caption:='Начать';.Caption:='Начать';.Enabled:=True;.Enabled:=True;.Caption:='Очистить';.Caption:='Очистить';.Enabled:=True;.Enabled:=True;.Enabled:=False;.Enabled:=False;
//
GroupBox.Enabled:=False;.Enabled:=False;.Enabled:=False;.Enabled:=False;.Enabled:=False;.Enabled:=False;.Enabled:=False;
// S2:=nil;('Слишком малое количество
узлов!',mtError,[mbOk],0);;;;TForm1.CheckBox1Click(Sender:
TObject);CheckBox1.Checked
then.Options:=[goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine,goRangeSelect,goEditing].Options:=[goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine,goRangeSelect];;TForm1.Edit3KeyPress(Sender:
TObject; var Key: Char);s:string;Sender=Edit3
then:=Edit3.Text;((Key=',')or(Key='.'))and (Pos(',',s)=0)thens=''
then.Text:='0,';:=#0;;.Text:=s+',';:=#0;;:=Edit4.Text;((Key=',')or(Key='.'))and
(Pos(',',s)=0)thens='' then.Text:='0,';:=#0;;.Text:=s+',';:=#0;;;((Key<'0')
or (Key>'9')) and not(Key=#8) then:=#0;;TForm1.FormCanResize(Sender:
TObject; var NewWidth,: Integer; var Resize:
Boolean);raz:integer;not(Button1.Enabled) and (Button4.Caption='Стоп') and
Button4.Enabled then:=false;;;(Width=NewWidth) and (Height=NewHeight)
then;(NewWidth<686) or (NewHeight<623)
then:=false;;;:=NewWidth-Width;.Left:=ProgressBar1.Left+raz;.Width:=Image1.Width+raz;.Height:=Image1.Height+(NewHeight-Height);.Left:=StringGrid1.Left+raz;.Left:=Label1.Left+raz;.Left:=Label8.Left+raz;.Left:=CheckBox1.Left+raz;.Left:=LabeledEdit1.Left+raz;.Left:=Button2.Left+raz;.Left:=LabeledEdit2.Left+raz;.Left:=Button1.Left+raz;.Left:=Button4.Left+raz;.Left:=StringGrid2.Left+raz;.Left:=Button3.Left+raz;;TForm1.Button2MouseDown(Sender:
TObject; Button: TMouseButton;: TShiftState; X, Y: Integer);
// FS:=Form1.Width;;TForm1.N16Click(Sender:
TObject);not(Button1.Enabled) and (Button4.Caption='Стоп') and Button4.Enabled
then;N16.Checked then.Visible:=True;.Visible:=True;.Visible:=True;.Visible:=True;.Visible:=True;.Visible:=True;.Visible:=True;.Visible:=True;.Visible:=True;.Visible:=True;.Width:=Form1.Width-295;.Checked:=False;.Visible:=False;.Visible:=False;.Visible:=False;.Visible:=False;.Visible:=False;.Visible:=False;.Visible:=False;.Visible:=False;.Visible:=False;.Visible:=False;.Width:=Form1.Width-25;.Checked:=True;;.Height:=Form1.Height-69;;TForm1.N17Click(Sender:
TObject);.Show;;TForm1.N18Click(Sender: TObject);OpenDialog.Execute()
then.FormCreate(N18);;TForm1.N19Click(Sender: TObject);.Visible:=True;;TForm1.N9Click(Sender:
TObject);GroupBox1.Visible
then.Visible:=False.Visible:=True;;TForm1.StringGrid1KeyPress(Sender: TObject;
var Key: Char);s:string;,y:Byte;:=StringGrid1.Selection.Left;x=5
then:=StringGrid1.Selection.Top;:=StringGrid1.Cells[x,y];((Key=',')or(Key='.'))and
(Pos(',',s)=0)thens=''
then.Cells[x,y]:='0,';:=#0;;.Cells[x,y]:=s+',';:=#0;;;;((key<'0') or
(key>'9')) and (key<>#8) then:=#0;;TForm1.Button6Click(Sender:
TObject);.Visible:=False;.Text:=IntToStr(Par[0]);.Text:=IntToStr(Par[1]);.Text:=IntToStr(Par[2]);.Text:=IntToStr(Par[3]);.Text:=IntToStr(Par[4]);.Text:=IntToStr(Par[5]);;TForm1.Button7Click(Sender:
TObject);Patch:string;LabeledEdit5.Text='' then('Введите имя Базы
Данных!',mtConfirmation,[mbOK],0):=ExtractFilePath(Application.ExeName)+'\БД\';not
CopyFile(PWideChar(Patch+'#.mdb'),PWideChar(Patch+LabeledEdit5.Text+'.mdb'),True)
then MessageDlg('База с таким именем уже существует! Перезаписать?',mtConfirmation,[mbNo,mbYes],0)=mrYes
then(PWideChar(Patch+'#.mdb'),PWideChar(Patch+LabeledEdit5.Text+'.mdb'),False);(Patch+LabeledEdit5.Text+'.mdb',128);.FormCreate(N19);.Visible:=False;;;TForm1.Button8Click(Sender:
TObject);.Visible:=False;;TForm1.Button5Click(Sender:
TObject);q,w:Real;(Edit1.Text='') or (Edit2.Text='') or (Edit3.Text='') or
(Edit4.Text='')(LabeledEdit3.Text='') or (LabeledEdit4.Text='')then
MessageDlg('Не все поля начальных параметров заполнены!',mtConfirmation,[mbOK],0);
exit;;(StrToInt(Edit1.Text)>StrToInt(Edit2.Text))
or (StrToInt(Edit3.Text)>StrToInt(Edit4 .Text))(StrToInt(Edit1.Text)=0) or
(StrToInt(Edit3.Text)=0) then
MessageDlg('Начальные параметры введены не верно!',mtConfirmation,[mbOK],0);
exit;;((StrToInt(LabeledEdit3.Text)>=StrToInt(LabeledEdit4.Text))
and (StrToInt(LabeledEdit3.Text)<StrToInt(Edit2.Text)))((StrToInt(LabeledEdit4.Text)>StrToInt(LabeledEdit3.Text))
and (StrToInt(LabeledEdit4.Text)<StrToInt(Edit2.Text))) then
exit;;(StrToInt(LabeledEdit3.Text)>46340)
or(StrToInt(LabeledEdit4.Text)>46340) then
MessageDlg('Ширина и высота не должны привышать 46340 м.!',mtConfirmation,[mbOK],0);
exit;;[0]:=StrToInt(LabeledEdit3.Text);[1]:=StrToInt(LabeledEdit4.Text);[2]:=StrToInt(Edit1.Text);[3]:=StrToInt(Edit2.Text);[4]:=StrToInt(Edit3.Text);[5]:=StrToInt(Edit4.Text);.Width:=Form1.Width-300;//293;.Height:=Form1.Height-70;//68;:=Par[1]/Par[0];:=Image1.Height/Image1.Width;not(w<q)
then.Width:=Image1.Width-10;.Height:=Round(Par[0]/Par[1]*Image1.Width).Height:=Image1.Height-10;.Width:=Round(Par[1]/Par[0]*Image1.Height);;(((w>q)and(Image1.Height<=Form1.Height-70))or((w<q)and(Image1.Width<=Form1.Width-300)));:=(Par[0]*Par[1])/(Image1.Width*Image1.Height);.Caption:='1
pix = '+FloatToStr(sqrt(Pix))+' (м)';;TForm1.N11Click(Sender: TObject);('By
MMK-P453 Troitskiy Sergey 2010-2011');;.
Листинг программы
(Unit2).Unit2;, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,, DB, ADODB, Grids, DBGrids, StdCtrls, XPMan;= class(TForm):
TADOConnection;: TADOTable;: TDataSource;: TADOTable;: TADOTable;:
TDataSource;: TDataSource;: TDBGrid;: TDBGrid;: TDBGrid;Id:
TAutoIncField;DSDesigner: TWideStringField;DSDesigner2:
TWideStringField;DSDesigner3: TWideStringField;DSDesigner4:
TIntegerField;DSDesigner5: TIntegerField;DSDesigner6: TWideStringField;:
TLabel;: TLabel;: TLabel;: TButton;: TXPManifest;: TButton;: TDBGrid;: TLabel;:
TADOTable;: TDataSource;FormCreate(Sender: TObject);FormDestroy(Sender:
TObject);DBGrid1CellClick(Column: TColumn);Button1Click(Sender:
TObject);Button2Click(Sender: TObject);
{ Private declarations }
{ Public declarations };: TForm2;Unit1;
{$R *.dfm}TForm2.FormCreate(Sender:
TObject);:TSearchRec;:Word;,Patch,PNFile:string;:TDateTime;: TFileTime;:
TSystemTime; Sender=Form1.N18 then // открытие выбранной Базы Данных
PNFile:=Form1.OpenDialog.FileNameif
Sender=Form1.N19 then // открытие cозданной Базы
Данных:=ExtractFilePath(Application.ExeName)+'\БД\'+Form1.LabeledEdit5.Text+'.mdb'
begin // Нахождение последней Базы Данных которая была
изменена в папке БД в каталоге с программой
Patch:=ExtractFilePath(Application.ExeName)+'\БД\';:=FindFirst(Patch+'*.mdb',faArchive,SR);:=SR.Name;(sr.FindData.ftLastWriteTime,
FileTime);(FileTime, SystemTime);:=SystemTimeToDateTime(SystemTime);result=0
do:=FindNext(SR);(sr.FindData.ftLastWriteTime, FileTime);(FileTime,
SystemTime);SystemTimeToDateTime(SystemTime)>DateTime
then:=SR.Name;:=SystemTimeToDateTime(SystemTime);;;:=Patch+FileName;;
// соединение и открытие Базы Данных
ADOConnection1.Connected:=False;.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data
Source='+PNFile+';Persist Security
Info=False';.Connected:=True;.Active:=True;.Active:=True;.Active:=True;.Active:=True;.FieldByName('Id').Visible:=true;.FieldByName('Id').Visible:=false;.FieldByName('Id').Visible:=false;.FieldByName('Id').Visible:=false;.Columns[0].Title.Caption:='№';.Columns[0].Width:=20;.Columns[1].Width:=138;
//
ADOTable3.FieldByName('Путь').Size:=30;('Ошибка при открытие Базы Данных!Доступ
ограничен, либо отсутствует!',mtError,[mbOk],0);.Connected:=False;.N7.Enabled:=False;;;TForm2.FormDestroy(Sender:
TObject);.N7.Enabled:=False;;TForm2.DBGrid1CellClick(Column:
TColumn);ADOTable1.Fields[0].AsString<>''
then.Filtered:=False;.Filtered:=False;.Filtered:=False;.Filter:='Испытание='+ADOTable1.FieldByName('Id').AsString;.Filter:='Испытание='+ADOTable1.FieldByName('Id').AsString;.Filter:='Испытание='+ADOTable1.FieldByName('Id').AsString;.Filtered:=True;.Filtered:=True;.Filtered:=True;;;TForm2.Button1Click(Sender:
TObject);ADOTable2.Filtered
then.Filtered:=False;.Filtered:=False;.Filtered:=False;;;TForm2.Button2Click(Sender:
TObject);.Close;;.