-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfLaser.pas
91 lines (74 loc) · 1.9 KB
/
fLaser.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
unit fLaser;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Imaging.pngimage,
Vcl.ExtCtrls, Vcl.ComCtrls, Vcl.Samples.Spin,unHelpForms;
type
TfrmLaser = class(TDefDevForm)
pnlLaser: TPanel;
Image3: TImage;
Label2: TLabel;
RichEdit1: TRichEdit;
GroupBox1: TGroupBox;
SpinEdit1: TSpinEdit;
Label1: TLabel;
RadioGroup1: TRadioGroup;
SpinEdit2: TSpinEdit;
procedure FormShow(Sender: TObject);
procedure SpinEdit1Change(Sender: TObject);
procedure SpinEdit2Change(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
procedure Setimage;
{ Private declarations }
public
{ Public declarations }
end;
var
frmLaser: TfrmLaser;
implementation
uses unDevices;
{$R *.dfm}
procedure TfrmLaser.FormCreate(Sender: TObject);
begin
SetSEfromParam(2,SpinEdit2);
radiogroup1.ItemIndex:=spinedit2.value;
Setimage;
end;
procedure TfrmLaser.FormShow(Sender: TObject);
begin
Param1SE:=SpinEdit1;
Param2SE:=SpinEdit2;
SpinEdit1.MaxValue:=arduino.MaxPins;
end;
procedure TfrmLaser.SpinEdit1Change(Sender: TObject);
begin
SetParam(1,TSpinEdit(Sender));
end;
procedure TfrmLaser.SpinEdit2Change(Sender: TObject);
begin
if radiogroup1.ItemIndex<>SpinEdit2.Value then
radiogroup1.ItemIndex:=SpinEdit2.Value;
Setimage;
end;
procedure TfrmLaser.RadioGroup1Click(Sender: TObject);
begin
SpinEdit2.Value:=radiogroup1.ItemIndex;
SetParam(2,SpinEdit2);
end;
procedure TfrmLaser.Setimage;
Var fnm:String;
Begin
fnm:=apppath+'\images\'+'Laser_'+inttostr(radiogroup1.ItemIndex)+'.jpg';
if NOT fileexists(fnm) then
fnm:=ChangeFileExt(fnm,'.png');
if fileexists(fnm) then
Begin
image3.Picture.LoadFromFile(fnm);
End
else
image3.Picture:=nil;
End;
end.