Вiзуальний облiк вхiдних даних iнтерфейсу RS-232
Дипломная работа - Компьютеры, программирование
Другие дипломы по предмету Компьютеры, программирование
on5: TSpeedButton;
SpeedButton6: TSpeedButton;
Timer1: TTimer;
GraphicDiagram1: TGraphicDiagram;
ScrollBar1: TScrollBar;
SavePictureDialog1: TSavePictureDialog;
SaveDialog1: TSaveDialog;
ActionList1: TActionList;
ImageList1: TImageList;
newGraphic: TAction;
saveDataGr: TAction;
LoadDataGR: TAction;
SaveGraph: TAction;
StartGr: TAction;
StopGr: TAction;
HelpPr: TAction;
ExitPr: TAction;
N7: TMenuItem;
SpeedButton7: TSpeedButton;
N8: TMenuItem;
OpenDialog1: TOpenDialog;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Edit12: TEdit;
Edit13: TEdit;
Edit14: TEdit;
Edit15: TEdit;
Label1: TLabel;
Edit16: TEdit;
BitBtn1: TBitBtn;
procedure ItemExitClick(Sender: TObject);
procedure Panel1Resize(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure PanelInstrumentResize(Sender: TObject);
procedure ItemNewClick(Sender: TObject);
// procedure SavePictureClick(Sender: TObject);
// procedure SaveDataClick(Sender: TObject);
procedure PauseClick(Sender: TObject);
procedure ClearClick(Sender: TObject);
procedure LinesClick(Sender: TObject);
procedure Start(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure SavePictureClick(Sender: TObject);
procedure GeneratorClick(Sender: TObject);
procedure LPTportClick(Sender: TObject);
procedure COMportClick(Sender: TObject);
procedure ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure AboutClick(Sender: TObject);
procedure newGraphicExecute(Sender: TObject);
procedure ExitPrExecute(Sender: TObject);
procedure StartGrExecute(Sender: TObject);
procedure StopGrExecute(Sender: TObject);
procedure SaveGraphExecute(Sender: TObject);
procedure saveDataGrExecute(Sender: TObject);
procedure HelpPrExecute(Sender: TObject);
procedure LoadDataGRExecute(Sender: TObject);
procedure ChangeTable(k:integer);
procedure BitBtn1Click(Sender: TObject);
procedure GeneratorOptionClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit3, aboutProgram, Unit4;
{$R *.dfm}
procedure TForm1.ItemExitClick(Sender: TObject);
begin
close;
end;
procedure TForm1.ChangeTable(k:integer);
var t:integer;
begin
t:=GraphicDiagram1.GetPointsCount;
if t<>0 then begin
if t>15 then
begin
Edit1.Text:=Edit2.Text;
Edit2.Text:=Edit3.Text;
Edit3.Text:=Edit4.Text;
Edit4.Text:=Edit5.Text;
Edit5.Text:=Edit6.Text;
Edit6.Text:=Edit7.Text;
Edit7.Text:=Edit8.Text;
Edit8.Text:=Edit9.Text;
Edit9.Text:=Edit10.Text;
Edit10.Text:=Edit11.Text;
Edit11.Text:=Edit12.Text;
Edit12.Text:=Edit13.Text;
Edit13.Text:=Edit14.Text;
Edit14.Text:=Edit15.Text;
Edit15.Text:=IntToStr(k);
end
else begin
case t of
1: Edit1.Text:=IntToStr(GraphicDiagram1.GetValue(0));
2: Edit2.Text:=IntToStr(k);
3: Edit3.Text:=IntToStr(k);
4: Edit4.Text:=IntToStr(k);
5: Edit5.Text:=IntToStr(k);
6: Edit6.Text:=IntToStr(k);
7: Edit7.Text:=IntToStr(k);
8: Edit8.Text:=IntToStr(k);
9: Edit9.Text:=IntToStr(k);
10: Edit10.Text:=IntToStr(k);
11: Edit11.Text:=IntToStr(k);
12: Edit12.Text:=IntToStr(k);
13: Edit13.Text:=IntToStr(k);
14: Edit14.Text:=IntToStr(k);
15: Edit15.Text:=IntToStr(k);
end;
end;
end;
end;
procedure TForm1.Panel1Resize(Sender: TObject);
begin
// panel1.Width:=form1.Width-10;
// panel1.Height:=form1.Height-200;
end;
procedure TForm1.FormResize(Sender: TObject);
begin
GraphicDiagram1.Resize(TControl(panel1));
// panel1Resize(self);
PanelInstrumentResize(self);
end;
procedure TForm1.PanelInstrumentResize(Sender: TObject);
begin
PanelInstrument.Width:=form1.Width-10;
end;
procedure TForm1.ItemNewClick(Sender: TObject);
var n:integer;
begin
GraphicDiagram1.Clear;
ScrollBar1.Enabled:=false;
end;
procedure TForm1.PauseClick(Sender: TObject);
begin
1then">if GraphicDiagram1.GetPointsCount<>1 then
begin
if SpeedButton4.Caption=Запуск then
begin
Fileitem.Enabled:=false;
// Interpolation.Enabled:=false;
Options.Enabled:=false;
SpeedButton1.Enabled:=false;
SpeedButton2.Enabled:=false;
SpeedButton3.Enabled:=false;
SpeedButton4.Caption:=Зупинити;
StartLoad.Caption:=Зупинити;
Timer1.Interval:=GraphicDiagram1.NumMiliSec;
Timer1.Enabled:=True;
Pause.Enabled:=true;
SpeedButton5.Enabled:=true;
end else
begin
GraphicDiagram1.DrawCountthen">if GraphicDiagram1.GetPointsCount>GraphicDiagram1.DrawCount then
begin
ScrollBar1.Enabled:=true;
ScrollBar1.SetParams(GraphicDiagram1.GetPointsCount,0,GraphicDiagram1.GetPointsCount);
end;
Fileitem.Enabled:=true;
// Interpolation.Enabled:=true;
Options.Enabled:=true;
SpeedButton1.Enabled:=true;
SpeedButton2.Enabled:=true;
SpeedButton3.Enabled:=true;
SpeedButton4.Caption:=Запуск;
StartLoad.Caption:=Запуск;
Timer1.Enabled:=false;
Pause.Enabled:=false;
SpeedButton5.Enabled:=false;
//Stop;
end;
end
else
begin
ScrollBar1.Enabled:=false;
Pause.Enabled:=false;
SpeedButton5.Enabled:=false;
end;
end;
procedure TForm1.ClearClick(Sender: TObject);
begin
form1.ItemNewClick(self);
end;
procedure TForm1.Start;
var
n:TPoint;
begin
new(n);
n^:=Random(255);
GraphicDiagram1.AddValue(n);
ChangeTable(n^);
end;
procedure TForm1.LinesClick(Sender: TObject);
begin
if not(Lines.Checked)then
begin
GraphicDiagram1.TypeDiagram:=tdLine;
Lines.Checked:=true;
Pilar.Checked:=false;
end else
begin
GraphicDiagram1.TypeDiagram:=tdColumn;
Lines.Checked:=false;
Pilar.Checked:=true;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
inherited;
randomize;
Form1.Pause.Enabled:=false;
Form1.SpeedButton5.Enabled:=false;
ScrollBar1.Enabled:=false;
Edit1.Text:=0;
// SaveDialog1.Create(self);
end;
procedure TForm1.SavePictureClick(Sender: TObject);
var
k:integer;
t:String;
begin
if SavePictureDialog1.Execute then
begin
t:=SavePictureDialog1.FileName;
repaint;
k:=GraphicDiagram1.SavePicture(t);
if k=0 then MessageDlg(Помилка при записi файла +t,mtError,[mbOk],0);
end;
end;
procedure TForm1.GeneratorClick(Sender: TObject);
begin
if not(Generator.Checked) then
begin
Generator.Checked:=true;
COMport.Checked:=false;
LPTport.Checked:=false;
end;
end;
procedure TForm1.LPTportClick(Sender: TObject);
begin
if not(LPTport.Checked)then
begin
Generator.Checked:=false;
COMport.Checked:=false;
LPTport.Checked:=true;
end;
end;
procedure TForm1.COMportClick(Sender: TObject);
begin
if not(COMport.Checked)then
begin
Generator.Checked:=false;
COMport.Checked:=true;
LPTport.Checked:=false;
end;
end;
procedure TForm1.ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
if ScrollCode=scEndScroll then
begin
0)and(ScrollPosGraphicDiagram1.GetPointsCount) then
begin
GraphicDiagram1.DrawStart:=ScrollPos-1;
GraphicDiagram1.Invalidate;
end
else if ScrollPos=0 then
begin
GraphicDiagram1.DrawStart:=0;
GraphicDiagram1.Invalidate;
end else
begin
GraphicDiagram1.DrawStart:=ScrollPos-1;
Graphic