unit
MainUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, XPMan, ImgList, Buttons, ComCtrls;
type
TForm1 =
class
(TForm)
Panel1: TPanel;
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
lbl1: TLabel;
XPManifest1: TXPManifest;
img1: TImage;
lbl2: TLabel;
img2: TImage;
lbl3: TLabel;
img3: TImage;
lbl4: TLabel;
edt1: TEdit;
lbl5: TLabel;
edt2: TEdit;
img4: TImage;
img5: TImage;
img6: TImage;
img7: TImage;
btn1: TBitBtn;
img8: TImage;
edt3: TEdit;
lbl6: TLabel;
lbl7: TLabel;
lbl8: TLabel;
lbl9: TLabel;
tmr1: TTimer;
lbl10: TLabel;
lbl11: TLabel;
edt4: TEdit;
img9: TImage;
lbl12: TLabel;
lbl13: TLabel;
UpDown1: TUpDown;
UpDown2: TUpDown;
UpDown3: TUpDown;
UpDown4: TUpDown;
UpDown5: TUpDown;
procedure
FormCreate(Sender: TObject);
procedure
btn1Click(Sender: TObject);
procedure
UpDown1ChangingEx(Sender: TObject;
var
AllowChange:
Boolean
;
NewValue:
Smallint
; Direction: TUpDownDirection);
procedure
UpDown2ChangingEx(Sender: TObject;
var
AllowChange:
Boolean
;
NewValue:
Smallint
; Direction: TUpDownDirection);
procedure
UpDown3ChangingEx(Sender: TObject;
var
AllowChange:
Boolean
;
NewValue:
Smallint
; Direction: TUpDownDirection);
procedure
UpDown4ChangingEx(Sender: TObject;
var
AllowChange:
Boolean
;
NewValue:
Smallint
; Direction: TUpDownDirection);
procedure
UpDown5ChangingEx(Sender: TObject;
var
AllowChange:
Boolean
;
NewValue:
Smallint
; Direction: TUpDownDirection);
private
public
end
;
procedure
Draw();
procedure
Calculate();
var
Form1: TForm1;
Btm1,Btm2,Btm3: TBitmap;
ro,mu,d,c,Re, OldRe, delta, deltaOtnos, Dzita:
Real
;
Mode:
byte
;
implementation
{$R *.dfm}
procedure
TForm1
.
FormCreate(Sender: TObject);
begin
Btm1:=Tbitmap
.
Create();
Btm2:=Tbitmap
.
Create();
Btm3:=Tbitmap
.
Create();
Btm1
.
LoadFromFile(
'Pictures/ris1.bmp'
);
Btm2
.
LoadFromFile(
'Pictures/ris2.bmp'
);
Btm3
.
LoadFromFile(
'Pictures/ris3.bmp'
);
Calculate();
Draw;
end
;
procedure
Calculate();
var
res1:
real
;
begin
try
ro:=strtofloat(Form1
.
edt1
.
text);
mu:=strtofloat(Form1
.
edit1
.
text);
d:=strtofloat(Form1
.
edt2
.
text);
c:=strtofloat(Form1
.
edt3
.
text);
delta:=strtofloat(Form1
.
edt4
.
text)/
1000
;
except
ShowMessage(
'Введите данные в верном фрмате (для отделения дробной части отцелой используйте запятую)'
);
end
;
Re:=ro*d*c/mu;
deltaOtnos:= delta/d;
res1:= deltaotnos*Re;
if
Res1<
10
then
mode:=
0
else
if
res1<
500
then
mode:=
1
else
mode:=
2
;
Form1
.
lbl9
.
Caption:=
'Re = '
+FloatToStrF(Re, ffFixed,
4
,
2
);
end
;
procedure
Draw();
begin
Form1
.
img7
.
Canvas
.
Rectangle(
0
,
0
,Form1
.
img7
.
Width-
1
,Form1
.
img7
.
Height-
1
);
case
Mode
of
0
: Form1
.
img7
.
Canvas
.
Draw(
100
,
100
,Btm1);
1
: Form1
.
img7
.
Canvas
.
Draw(
100
,
100
,Btm2);
2
: Form1
.
img7
.
Canvas
.
Draw(
100
,
100
,Btm3);
end
;
end
;
procedure
TForm1
.
btn1Click(Sender: TObject);
begin
Calculate();
Draw();
end
;
procedure
TForm1
.
UpDown1ChangingEx(Sender: TObject;
var
AllowChange:
Boolean
; NewValue:
Smallint
;
Direction: TUpDownDirection);
begin
if
Direction = updUp
then
begin
mu:=mu+
0.00001
;
Edit1
.
Text:=FloatToStrF(mu,ffFixed,
4
,
6
);
end
else
if
Direction = updDown
then
if
mu>=
0.000001
then
begin
mu:=mu-
0.00001
;
edit1
.
Text:=FloatToStrF(mu,ffFixed,
4
,
6
);
end
;
end
;
procedure
TForm1
.
UpDown2ChangingEx(Sender: TObject;
var
AllowChange:
Boolean
; NewValue:
Smallint
;
Direction: TUpDownDirection);
begin
if
Direction = updUp
then
begin
ro:=ro+
1
;
Edt1
.
Text:=FloatToStrF(ro,ffFixed,
4
,
1
);
end
else
if
Direction = updDown
then
if
ro>=
1
then
begin
ro:=ro-
1
;
Edt1
.
Text:=FloatToStrF(ro,ffFixed,
4
,
1
);
end
;
end
;
procedure
TForm1
.
UpDown3ChangingEx(Sender: TObject;
var
AllowChange:
Boolean
; NewValue:
Smallint
;
Direction: TUpDownDirection);
begin
if
Direction = updUp
then
begin
d:=d+
0.01
;
Edt2
.
Text:=FloatToStrF(d,ffFixed,
4
,
2
);
end
else
if
Direction = updDown
then
if
d>=
0.02
then
begin
d:=d-
0.01
;
Edt2
.
Text:=FloatToStrF(d,ffFixed,
4
,
2
);
end
;
end
;
procedure
TForm1
.
UpDown4ChangingEx(Sender: TObject;
var
AllowChange:
Boolean
; NewValue:
Smallint
;
Direction: TUpDownDirection);
begin
if
Direction = updUp
then
begin
c:=c+
0.01
;
Edt3
.
Text:=FloatToStrF(c,ffFixed,
4
,
2
);
end
else
if
Direction = updDown
then
if
c>=
0.02
then
begin
c:=c-
0.01
;
Edt3
.
Text:=FloatToStrF(c,ffFixed,
4
,
2
);
end
;
end
;
procedure
TForm1
.
UpDown5ChangingEx(Sender: TObject;
var
AllowChange:
Boolean
; NewValue:
Smallint
;
Direction: TUpDownDirection);
begin
if
Direction = updUp
then
begin
delta:=delta+
0.00005
;
Edt4
.
Text:=FloatToStrF(delta*
1000
,ffFixed,
4
,
2
);
end
else
if
Direction = updDown
then
if
delta>=
0.00006
then
begin
delta:=delta-
0.00005
;
Edt4
.
Text:=FloatToStrF(delta*
1000
,ffFixed,
4
,
2
);
end
;
end
;
end
.