unit MEnd;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,mat,
StdCtrls;
type
TMatrEnd = class(TForm)
Button1: TButton;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
EditMas:array[1..30,1..30] of TMyEdit;
end;
var
MatrEnd: TMatrEnd;
implementation
uses MAI;
{$R *.DFM}
procedure TMatrEnd.FormShow(Sender: TObject);
var
x,y,c:integer;
kon,a,b:extended;
s:string;
begin
For y:=1 to Form1.level[4]+1 do begin
kon:=0;
For x:=1 to Form1.Level[3]+2 do begin
EditMas[y,x]:=TMyEdit.Create(self);
EditMas[y,x].x:=x;
EditMas[y,x].y:=y;
EditMas[y,x].Parent:=self;
EditMas[y,x].Top:=(y-1)*20+1;
EditMas[y,x].left:=x*90-28;
EditMas[y,x].Width:=90;
EditMas[y,x].Height:=20;
EditMas[y,x].ReadOnly:=True;
If (y=1) and (x>1) then
EditMas[y,x].text:=Form1.MasHide[0,x-1,Form1.level[2]+2];
if x=1 then begin
EditMas[y,x].Width:=150;
EditMas[y,x].Left:=1;
if y>1 then EditMas[y,x].Text:=Form1.Memos[4,y-1].Text;
end;
if (x>1) and (y>1) and (x<Form1.Level[3]+2) then begin
EditMas[y,x].text:=Form1.MasHide[x+Form1.level[2]-1,y-1,Form1.level[4]+2];
//Теперь умножаем их на соответствующие коэффициенты
val(EditMas[y,x].text,a,c);
val(EditMas[2,x].Text,b,c);
kon:=kon+(a*b);
end;
end;
Case Form1.Opt.col of
one: EditMas[y,Form1.level[3]+2].color:=cl3DLight;
all: begin
EditMas[y,Form1.level[3]+2].color:=cl3DLight;
For x:=2 to form1.level[3]+1 do
if (y mod 2)=0 then EditMas[y,x].color:=clSilver;
end;
end;
Str(kon:8:8,s);
EditMas[y,Form1.level[3]+2].Text:=s;
end;
EditMas[1,form1.level[3]+2].text:='Общие веса';
If (Width>=screen.Width) or (Height>=screen.Height) then AutoScroll:=true
else AutoScroll:=false;
Autosize:=True;
If (Width>=screen.Width) or (Height>=screen.Height) then AutoScroll:=true
else AutoScroll:=false;
Autosize:=False;
if AutoScroll then height:=height+16;
end;
procedure TMatrEnd.FormClose(Sender: TObject; var Action: TCloseAction);
begin
MatrEnd.free;
MatrEnd:=nil;
Form1.N10.Enabled:=False;
Form1.N15.Enabled:=False;
end;
end.