📄 lpdchxing.pas
字号:
button6.Left :=bdagrid1.left+75;
button6.top:=button2.Top +40;
button4.Left :=bdagrid1.left+75;
button4.top:=button6.top+60;
radiobutton1.Left :=bdagrid1.left+78;
radiobutton2.Left :=bdagrid1.left+78;
bevel1.Left :=bdagrid1.left+75;
label4.top :=cxbgrid2.top+25;
label5.top:=label4.top+label4.Height +10;
label2.top :=cxbgrid1.top+25;
label3.top:=label2.top+label2.Height +10;
label7.left:=cxbgrid1.left;
label8.left:=cxbgrid1.left;
label9.left:=cxbgrid1.left;
label10.left:=cxbgrid1.left;
label7.top :=objedit1.Top;
label8.top :=label7.top+label7.height;
label9.top :=objedit2.top;
label10.top :=label9.top+label9.Height ;
if (button4.top+button4.Height) <(czgrid2.top+czgrid2.height) then
begin
dchxingform.Height :=czgrid2.top+czgrid2.Height +70;
end
else
begin
dchxingform.height:=button4.top+button4.height+70;
end;
statusbar1.Height :=40;
dchxingform.Width :=button1.Left+button1.Width +30;
{***********************如果大于满屏时******************************}
if (dchxingform.Width>800) then
begin
dchxingform.Width:=800;
xigrid1.Width :=(xigrid1.ColWidths[0]+1)*9+5;
xigrid1.Height :=xigrid1.Height +20;
xigrid1.ScrollBars:=sshorizontal;
agrid1.Width :=(agrid1.ColWidths[0]+1)*9+5;
agrid1.Height :=agrid1.Height +20+2;
agrid1.ScrollBars :=sshorizontal;
czgrid1.Width :=(czgrid1.ColWidths[0]+1)*9+5;
czgrid1.Height :=czgrid1.Height +20;
czgrid1.ScrollBars :=sshorizontal;
agrid2.Width :=(agrid2.ColWidths[0]+1)*9+5;
agrid2.Height :=agrid2.Height +20+2;
agrid2.ScrollBars :=sshorizontal;
czgrid2.Width :=(czgrid2.ColWidths[0]+1)*9+5;
czgrid2.Height :=czgrid2.Height +20;
czgrid2.ScrollBars :=sshorizontal;
agrid1.left:=xigrid1.left;
agrid1.top:=xigrid1.top+xigrid1.Height;
cxbgrid1.left:=agrid1.left-cxbgrid1.Width ;
cxbgrid1.top:=agrid1.top-cxbgrid1.RowHeights[0] ;
bdagrid1.left:=agrid1.left+agrid1.Width ;
bdagrid1.top:=agrid1.top-cxbgrid1.RowHeights[0] ;
czgrid1.left:=agrid1.left;
czgrid1.top:=agrid1.top+agrid1.Height;
objedit1.left:=cxbgrid1.left+82;
objedit1.top:=czgrid1.Top+5;
label7.top:=objedit1.top+5;
label7.left:=cxbgrid1.left;
label8.top:=label7.top+label7.Height ;
label8.left:=label7.left;
agrid2.left:=agrid1.left;
agrid2.top:=label8.top+70;
cxbgrid2.left:=agrid2.left-cxbgrid2.Width ;
cxbgrid2.top:=agrid2.top;
bdagrid2.left:=agrid2.left+agrid2.Width ;
bdagrid2.top:=agrid2.top;
czgrid2.left:=agrid2.left;
czgrid2.top:=agrid2.top+agrid1.Height;
objedit2.left:=cxbgrid2.left+82;
objedit2.top:=czgrid2.Top+3;
label9.top:=czgrid2.top+5;
label9.left:=cxbgrid2.left;
label10.top:=label9.top+label9.Height ;
label10.left:=label9.left;
{控件操作}
button1.Left :=bdagrid1.left+75;
button1.top:=bevel1.top+bevel1.Height +10;
button5.Left :=bdagrid1.left+75;
button5.top:=button1.top+40;
button3.Left :=bdagrid1.left+75;
button3.top:=button5.top+40;
button2.Left :=bdagrid1.left+75;
button2.top:=button3.top+40;
button6.Left :=bdagrid1.left+75;
button6.top:=button2.Top +40;
button4.Left :=bdagrid1.left+75;
button4.top:=button6.top+60;
radiobutton1.Left :=bdagrid1.left+78;
radiobutton2.Left :=bdagrid1.left+78;
bevel1.Left :=bdagrid1.left+75;
label4.top :=cxbgrid2.top+25;
label5.top:=label4.top+label4.Height +10;
label2.top :=cxbgrid1.top+25;
label3.top:=label2.top+label2.Height +10;
if (button4.top+button4.Height) <(czgrid2.top+czgrid2.height) then
begin
dchxingform.Height :=czgrid2.top+czgrid2.Height +60;
end
else
begin
dchxingform.height:=button4.top+button4.height+60;
end;
end;
if (dchxingform.Height >600)then
begin
dchxingform.autoscroll:=true;
dchxingform.height:=600;
if agrid1.ScrollBars =sshorizontal then
agrid1.Height :=(agrid1.RowHeights[0]+1)*5+20+2
else
agrid1.Height :=(agrid1.RowHeights[0]+1)*5+2;
agrid1.Width :=agrid1.width+17;
if dchxingform.Width >780 then
agrid1.ScrollBars :=ssboth
else
agrid1.ScrollBars :=ssvertical;
cxbgrid1.Height :=(cxbgrid1.RowHeights[0]+1)*6+5;
cxbgrid1.Width :=cxbgrid1.width+17;
cxbgrid1.ScrollBars :=ssvertical;
bdagrid1.Height :=(bdagrid1.RowHeights[0]+1)*6+5;
bdagrid1.Width :=bdagrid1.width+17;
bdagrid1.ScrollBars :=ssvertical;
if agrid2.ScrollBars =sshorizontal then
agrid2.Height :=(agrid2.RowHeights[0]+1)*5+20+2
else
agrid2.Height :=(agrid2.RowHeights[0]+1)*5+2;
agrid2.Width :=agrid2.width+17;
if dchxingform.Width >780 then
begin
agrid2.ScrollBars :=ssboth;
dchxingform.autoscroll:=true;
end
else
agrid2.ScrollBars :=ssvertical;
cxbgrid2.Height :=(cxbgrid2.RowHeights[0]+1)*5+5;
cxbgrid2.Width :=cxbgrid2.width+17;
cxbgrid2.ScrollBars :=ssvertical;
bdagrid2.Height :=(bdagrid2.RowHeights[0]+1)*5+5;
bdagrid2.Width :=bdagrid2.width+17;
bdagrid2.ScrollBars :=ssvertical;
agrid1.left:=xigrid1.left;
agrid1.top:=xigrid1.top+xigrid1.Height;
cxbgrid1.left:=agrid1.left-cxbgrid1.Width ;
cxbgrid1.top:=agrid1.top-cxbgrid1.RowHeights[0] ;
bdagrid1.left:=agrid1.left+agrid1.Width ;
bdagrid1.top:=agrid1.top-cxbgrid1.RowHeights[0] ;
czgrid1.left:=agrid1.left;
czgrid1.top:=agrid1.top+agrid1.Height;
objedit1.left:=cxbgrid1.left+82;
objedit1.top:=czgrid1.Top+3;
label7.top:=czgrid1.top+5;
label7.left:=cxbgrid1.left;
label8.top:=label7.top+label7.Height ;
label8.left:=label7.left;
agrid2.left:=agrid1.left;
agrid2.top:=label8.top+70;
cxbgrid2.left:=agrid2.left-cxbgrid2.Width ;
cxbgrid2.top:=agrid2.top;
bdagrid2.left:=agrid2.left+agrid2.Width ;
bdagrid2.top:=agrid2.top;
czgrid2.left:=agrid2.left;
czgrid2.top:=agrid2.top+agrid1.Height;
objedit2.left:=cxbgrid2.left+82;
objedit2.top:=czgrid2.Top+3;
label9.top:=czgrid2.top+5;
label9.left:=cxbgrid2.left;
label10.top:=label9.top+label9.Height ;
label10.left:=label9.left;
{控件操作}
button1.Left :=bdagrid1.left+75;
button1.top:=bevel1.top+bevel1.Height +10;
button5.Left :=bdagrid1.left+75;
button5.top:=button1.top+40;
button3.Left :=bdagrid1.left+75;
button3.top:=button5.top+40;
button2.Left :=bdagrid1.left+75;
button2.top:=button3.top+40;
button6.Left :=bdagrid1.left+75;
button6.top:=button2.Top +40;
button4.Left :=bdagrid1.left+75;
button4.top:=button6.top+60;
radiobutton1.Left :=bdagrid1.left+78;
radiobutton2.Left :=bdagrid1.left+78;
bevel1.Left :=bdagrid1.left+75;
label4.top :=cxbgrid2.top+25;
label5.top:=label4.top+label4.Height +10;
label2.top :=cxbgrid1.top+25;
label3.top:=label2.top+label2.Height +10;
statusbar1.Height :=40;
dchxingform.Width :=button1.Left+button1.Width +30;
end;
// dchxingform.Position :=poscreencenter;
{**************************}
if jisuan_over=false then
begin
with cxbgrid1 do
begin cells[0,0]:='Cb';
cells[1,0]:='Xb';
cells[2,0]:='B';
end;
with xigrid1 do
for i:=0 to colcount-1 do
begin
cells[i,0]:='X'+inttostr(i+1);
if (c^[i+1].att='RGB')and(mainchoose=10) then
begin
cells[i,1]:='-M';{i用c^[i]代替}
c^[i+1].num:=-bigm
end
else
if (c^[i+1].att='RGB')and(mainchoose=20)and(jieduan2=true) then
cells[i,1]:=''
else
cells[i,1]:=floattostr(c^[i+1].num);{i用c^[i]代替}
end;{读入变量xi上标}
with bdagrid1 do
begin
cells[0,0]:='Bj/Aij';
end;
for i:=1 to afterleashnum do
bdagrid2.cells[0,i-1]:='';
if studymode then
begin
if biaonum=1 then
begin
czgrid1.Options :=czgrid1.Options +[goediting];
bdagrid1.Options :=bdagrid1.Options +[goediting];
objedit1.Enabled :=true;
end
else
begin
czgrid1.Options :=czgrid1.Options -[goediting];
bdagrid1.Options :=bdagrid1.Options -[goediting];
czgrid2.Options :=czgrid2.Options +[goediting];
bdagrid2.Options :=bdagrid2.Options +[goediting];
cxbgrid2.Options :=cxbgrid2.Options +[goediting];
agrid2.Options :=bdagrid2.Options +[goediting];
objedit2.Enabled :=true;
objedit1.Enabled :=false;
end;
end;
readcbx;
readintogrid;
findbasevar;
end;
end;{end of formactivate}
function Tdchxingform.judge_basevar(i:integer):boolean;
var j:integer;
begin
{daizuo}
judge_basevar:=false;
for j:=1 to varnum do
if i=basevar[j] then
judge_basevar:=true;
end;
procedure Tdchxingform.findbasevar;{寻找基变量}
var i,j,k,one_num,zero_num:integer;
bpbasevar,tempbasevar:array[1..50]of integer;
begin
k:=1;
// for i:=1 to afterleashnum do {刚做完标准化时适用}
// for j:=afteraddvarnum downto (afteraddvarnum-afterleashnum+1) do
// if a^[i,j]=1 then{有一个默认情况,只要后面的列}
// begin {中有1,肯定就是基变量}
// basevar[k]:=j;
// k:=k+1;
// end;
for i:=10 to 50 do
begin
tempbasevar[i]:=0;
bpbasevar[i]:=0;
end;
for i:=1 to afteraddvarnum do
begin
one_num:=0; zero_num:=0;
for j:= 1 to afterleashnum do
begin
if a^[j,i]=1 then one_num:=one_num+1;
if a^[j,i]=0 then zero_num:=zero_num+1;
end;
if (one_num=1)and (zero_num=(afterleashnum-1)) then
begin
basevar[k]:=i;
k:=k+1;
end;
end; {找到基变量}
for i:=1 to afterleashnum do
begin
for j:=1 to afterleashnum do
begin
if a^[j,basevar[i]]=1 then tempbasevar[i]:=j;
end;
end;
for i:=1 to afterleashnum do
bpbasevar[i]:=basevar[i];
for i:=1 to afterleashnum do
basevar[tempbasevar[i]]:=bpbasevar[i];
for i:= 1 to afterleashnum do
cb[i]:=c^[basevar[i]].num;
with cxbgrid1 do
for i:=1 to afterleashnum do
begin
if c^[basevar[i]].num=-bigm then
cells[0,i]:='-M'
else
cells[0,i]:=floattostr(c^[basevar[i]].num);
cells[1,i]:='X'+inttostr(basevar[i]);
cells[2,i]:=floattostr(b^[i]);
end
end;
{********************以下为数据处理***************************** ****}
procedure Tdchxingform.readintogrid;
var i,j:integer;{开始做单纯形表时将grid1写如数据}
begin
with aGrid1 do
for J:= 1 to RowCount do
for I := 0 to ColCount-1 do
begin
Cells[I,J-1] := floattostr(a^[j,i+1]);{k用对应的矩阵系数a^[i]代替}
end;
with aGrid2 do
for J:= 1 to RowCount do
for I := 0 to ColCount-1 do
begin
Cells[I,J-1] :='';{k用对应的矩阵系数a^[i]代替}
end;
with czgrid2 do
for i:=0 to colcount-1 do
for j:=0 to rowcount-1 do
cells[i,j]:='';
end;
{数据输入}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -