R
rzqcjwrz
Unregistered / Unconfirmed
GUEST, unregistred user!
var
PanelW : array[0..63] of TPanel;
i,n,k,x,m,iWidth,iHeight,chanelnum : Integer;//5*4
s,temp:string;
begin
chanelnum:=24;//通道数
if chanelnum <= 4 then
x:=4
else if chanelnum<9 then
x:=9
else if chanelnum<=16 then
x:=16
else if chanelnum <= 25 then
x:=25
else if chanelnum<=36 then
x:=36
else if chanelnum<=49 then
x:=49
else if chanelnum<=64 then
x:=8;
Str(Sqrt(x):5:0, Temp);
S :=temp;
k:=strtoint(s);
m:=k;
n:=k;
iWidth:=352 div n;
iHeight:=288 div m;
for i := 0 to m*n-1 do
begin
PanelW:=TPanel.Create(self);
PanelW.Parent:=Self;//self为父级控件
PanelW.Width:=iWidth;
PanelW.Height:=iHeight;
PanelW.Visible:=True;
PanelW.Top:=(i div n)*iHeight;
PanelW.Left:=(i mod n)*iwidth;
PanelW.Caption:=inttostr(i);
end;
end;
PanelW : array[0..63] of TPanel;
i,n,k,x,m,iWidth,iHeight,chanelnum : Integer;//5*4
s,temp:string;
begin
chanelnum:=24;//通道数
if chanelnum <= 4 then
x:=4
else if chanelnum<9 then
x:=9
else if chanelnum<=16 then
x:=16
else if chanelnum <= 25 then
x:=25
else if chanelnum<=36 then
x:=36
else if chanelnum<=49 then
x:=49
else if chanelnum<=64 then
x:=8;
Str(Sqrt(x):5:0, Temp);
S :=temp;
k:=strtoint(s);
m:=k;
n:=k;
iWidth:=352 div n;
iHeight:=288 div m;
for i := 0 to m*n-1 do
begin
PanelW:=TPanel.Create(self);
PanelW.Parent:=Self;//self为父级控件
PanelW.Width:=iWidth;
PanelW.Height:=iHeight;
PanelW.Visible:=True;
PanelW.Top:=(i div n)*iHeight;
PanelW.Left:=(i mod n)*iwidth;
PanelW.Caption:=inttostr(i);
end;
end;