procedure TFmAutobs.toProcDfmTxtS(sc1,sc2,sc3,sc4,sc5:string);
const
row2=50;
col2=4;
lrAside=10;
width1=60;
width2=160;
height1=23;
btnMagins=200;
var
S,S1,S2,S3,S4:String;
i:integer;
left1,top1:Integer;
TS:TStrings;
rc,rd:Integer;
ctype:Integer;
itcbo:String;
temp:TStringList;
procedure toProcDbedit;
begin
S3:=‘lbl’+inttostr(I);
TS.add(’ object ‘+S3+’: TLabel’);
top1:=(((i) div col2)mod row2) * (height1+ lrAside) + lrAside ;
left1:=((i) mod col2) * (width1 + btnMagins) + lrAside;
TS.add(’ Left = ‘+inttostr(left1));
TS.add(’ Top = ‘+inttostr(top1));
TS.add(’ Width = ‘+inttostr(width1));
TS.add(’ Height = ‘+inttostr(height1));
S1:=slist2[I];
TS.add(’ Caption = ‘+QuotedStr(s1));
TS.add(’ end’);
S3:=‘dbe’+inttostr(I);
ctype:=strtoint(slist3[I]);
case ctype of
1:S3:= S3+‘: TDBEdit’;
2:S3:=S3+‘: TcxDBButtonEdit’;
3:S3:=S3+‘: TcxDBDateEdit’;
4:S3:=S3+‘: TcxDBComboBox’;
5:S3:=S3+‘: TDBCheckBox’;
6:S3:=S3+‘: TcxDBMemo’;
{1:S3:=‘dbe’+inttostr(I)+‘: TDBEdit’;
2:S3:=‘btn’+inttostr(I)+‘: TcxDBButtonEdit’;
3:S3:=‘dte’+inttostr(I)+‘: TcxDBDateEdit’;
4:S3:=‘cbo’+inttostr(I)+‘: TcxDBComboBox’;
5:S3:=‘chk’+inttostr(I)+‘: TDBCheckBox’;
6:S3:=‘mem’+inttostr(I)+‘: TcxDBMemo’;}
end;
//TS.add(‘object ‘+S3+’: TDBEdit’);
TS.add(’ object ‘+S3);
TS.add(’ Left = ‘+inttostr(left1+width1+15));
TS.add(’ Top = ‘+inttostr(top1));
TS.add(’ Width = ‘+inttostr(width2));
TS.add(’ Height = '+inttostr(height1));
case ctype of
1,5:begin
if ctype=5 then
begin
S1:=slist2[I];
TS.add(' Caption = '+QuotedStr(s1));
end;
S2:=slist1[I];
TS.add(' DataField = '+QuotedStr(s2));
TS.add(' DataSource = ds1');
if ctype=5 then
begin
TS.Add(' ValueChecked = '+QuotedStr('Y'));
TS.Add(' ValueUnchecked = '+QuotedStr('N'));
end;
end;
2,3,4,6: begin
S2:=slist1[I];
TS.add(’ DataBinding.DataField = ‘+QuotedStr(s2));
TS.add(’ DataBinding.DataSource = ds1’);
{if ctype=4 then
begin
TS.add(’ Properties.Items.Strings = (‘);
temp.Clear;
temp.Delimiter := ‘、’;
temp.DelimitedText := slist4[I];
for K := 0 to temp.Count-1 do
begin
itcbo:=temp[K];
if K<temp.Count-1 then
TS.Add(quotedstr(itcbo))
else
TS.Add(quotedstr(itcbo)+’)');
end;
end;}
end;
end;
TS.add(’ TabOrder = ‘+inttostr(I));
TS.add(’ end’);
end;
begin
//
TS:=TStringList.Create;
temp:=TStringList.Create;
try
TS.Clear;
// S:=‘FmTemp: TFmTemp’;
S:=‘Fm’+sc1+‘:’+’ TFm’+sc1;
TS.Add(‘inherited ‘+S);
// s1:=‘temp’;
S1:=‘Fm’+sc1;
TS.add(‘Caption =’+QuotedStr(s1)); //s.QuotedString
TS.add(‘OnClose = FormClose’);
TS.ADD(’ ExplicitWidth = 1302’);
TS.ADD(’ ExplicitHeight = 748’);
TS.ADD(’ TextHeight = 12’);
TS.ADD(’ inherited Panel1: TPanel’);
TS.ADD(’ inherited PageControl1: TPageControl’);
TS.ADD(’ inherited TabSheet7: TTabSheet’);
TS.ADD(’ inherited Panel14: TPanel’);
TS.ADD(’ ExplicitLeft = 0’);
TS.ADD(’ ExplicitTop = 0’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ inherited PageControl2: TPageControl’);
TS.ADD(’ inherited TabSheet9: TTabSheet’);
TS.ADD(’ inherited Panel10: TPanel’);
TS.ADD(’ inherited Panel9: TPanel’);
TS.ADD(’ inherited DBGrid1: TDBGrid’);
TS.add(’ Columns = <‘);
toProcslist(slist1,slist2,slist3,slist4,sc1,rc);
if rc>=1 then
begin
for I := 0 to rc-1 do
begin
TS.add(’ item’);
TS.add(’ Expanded = False’);
// S2:=‘MD00’+inttostr(I);
s2:= slist1[I];
TS.add(’ FieldName = ‘+QuotedStr(s2));
// S3:=‘测试’+inttostr(I);
S3:=slist2[i];
TS.add(’ Title.Caption = ‘+QuotedStr(s3));
TS.add(’ Visible = True’);
TS.add(’ end’);
end;
end;
TS.add(‘>’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ inherited Panel11: TPanel’);
TS.ADD(’ ExplicitTop = 94’);
TS.ADD(’ inherited Panel12: TPanel’);
TS.ADD(’ ExplicitTop = 0’);
rd:=row2*col2;
TS.add(‘Height =’+ inttostr(((min(rc,rd) div col2)+1)* (height1+ lrAside) + lrAside+35));
TS.ADD(’ inherited Panel19: TPanel’);
TS.ADD(’ ExplicitLeft = 0 ‘);
TS.ADD(’ ExplicitTop = 0 ');
TS.add(‘Height =’+ inttostr(((min(rc,rd) div col2)+1)* (height1+ lrAside) + lrAside+35));
for I := 0 to rc-1 do
begin
if(rc<=rd) then toprocdbedit;
if (rc>rd) then
begin
if rd-1=I then
begin
TS.ADD(’ object Panel19A: TPanel’);
TS.ADD(’ Left = 0 ‘);
TS.ADD(’ Top = 0 ‘);
TS.ADD(’ Width = 1177 ‘);
TS.ADD(’ Height = 249 ‘);
TS.ADD(’ Align = alClient ‘);
TS.ADD(’ Caption = ‘+Quotedstr(‘Panel20’));
end;
//;
toprocdbedit;
if (rc-1=I) then TS.ADD(’ end’);
end;
end;
TS.add(’ end’);
TS.add(’ end’);
toFreeslist(slist1,slist2,slist3,slist4);
TS.ADD(’ inherited Panel13: TPanel’);
TS.ADD(’ ExplicitLeft = 1’);
TS.ADD(’ ExplicitTop = 252’);
TS.ADD(’ ExplicitHeight = 355’);
TS.ADD(’ inherited PageControl3_basemd: TPageControl’);
TS.ADD(’ inherited TabSheet10_basemd: TTabSheet’);
TS.ADD(’ inherited cxGrid1: TcxGrid’);
TS.ADD(’ inherited cxGrid1DBTableView1: TcxGridDBTableView’);
toprocslist(slist1,slist2,slist3,slist4,sc2,rc);
for I := 0 to rc-1 do
begin
S3:=‘cxGrid1DBTableView1’+slist1[I];
S2:=slist1[I];
TS.add(’ object ‘+S3+’: TcxGridDBColumn’);
S4:=slist2[i];
TS.add(’ Caption = ‘+QuotedStr(s4));
TS.add(’ DataBinding.FieldName = ‘+QuotedStr(s2));
TS.add(’ end’);
end;
toFreeslist(slist1,slist2,slist3,slist4);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ inherited TabSheet10: TTabSheet’);
TS.ADD(’ inherited cxGrid2: TcxGrid’);
TS.ADD(’ inherited cxGridDBTableView1: TcxGridDBTableView’);
toprocslist(slist1,slist2,slist3,slist4,sc3,rc);
for I := 0 to rc-1 do
begin
S3:=‘cxGridDBTableView1’+slist1[I];
S2:=slist1[I];
TS.add(’ object ‘+S3+’: TcxGridDBColumn’);
S4:=slist2[i];
TS.add(’ Caption = ‘+QuotedStr(s4));
TS.add(’ DataBinding.FieldName = ‘+QuotedStr(s2));
TS.add(’ end’);
end;
toFreeslist(slist1,slist2,slist3,slist4);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ inherited TabSheet11: TTabSheet’);
TS.ADD(’ inherited cxGrid3: TcxGrid’);
TS.ADD(’ inherited cxGridDBTableView2: TcxGridDBTableView’);
toprocslist(slist1,slist2,slist3,slist4,sc4,rc);
for I := 0 to rc-1 do
begin
S3:=‘cxGridDBTableView2’+slist1[I];
S2:=slist1[I];
TS.add(’ object ‘+S3+’: TcxGridDBColumn’);
S4:=slist2[i];
TS.add(’ Caption = ‘+QuotedStr(s4));
TS.add(’ DataBinding.FieldName = ‘+QuotedStr(s2));
TS.add(’ end’);
end;
toFreeslist(slist1,slist2,slist3,slist4);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ inherited TabSheet12: TTabSheet’);
TS.ADD(’ inherited cxGrid4: TcxGrid’);
TS.ADD(’ inherited cxGridDBTableView3: TcxGridDBTableView’);
toprocslist(slist1,slist2,slist3,slist4,sc5,rc);
for I := 0 to rc-1 do
begin
S3:=‘cxGridDBTableView3’+slist1[I];
S2:=slist1[I];
TS.add(’ object ‘+S3+’: TcxGridDBColumn’);
S4:=slist2[i];
TS.add(’ Caption = ‘+QuotedStr(s4));
TS.add(’ DataBinding.FieldName = ‘+QuotedStr(s2));
TS.add(’ end’);
end;
toFreeslist(slist1,slist2,slist3,slist4);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ end’);
TS.ADD(’ inherited cxStyleRepository3: TcxStyleRepository’);
TS.ADD(’ PixelsPerInch = 96’);
TS.ADD(’ end’);
TS.ADD(’ inherited cxStyleRepository2: TcxStyleRepository’);
TS.ADD(’ PixelsPerInch = 96’);
TS.ADD(’ end’);
TS.ADD(’ inherited cxStyleRepository1: TcxStyleRepository’);
TS.ADD(’ PixelsPerInch = 96’);
TS.ADD(’ end’);
TS.ADD(’ inherited cxImageList1: TcxImageList’);
TS.ADD(’ FormatVersion = 1’);
TS.ADD(’ end’);
TS.ADD(’ inherited cxStyleRepository6: TcxStyleRepository’);
TS.ADD(’ PixelsPerInch = 96’);
TS.ADD(’ end’);
TS.ADD(’ inherited cxStyleRepository5: TcxStyleRepository’);
TS.ADD(’ PixelsPerInch = 96’);
TS.ADD(’ end’);
TS.ADD(’ inherited cxStyleRepository4: TcxStyleRepository’);
TS.ADD(’ PixelsPerInch = 96’);
TS.ADD(’ end’);
TS.ADD(’ inherited tipWin: TdxAlertWindowManager’);
TS.ADD(’ PixelsPerInch = 96’);
TS.ADD(’ end’);
TS.ADD(’ inherited cxImageList2: TcxImageList’);
TS.ADD(’ FormatVersion = 1’);
TS.ADD(’ end’);
TS.ADD(‘end’);
//if SaveDialog1.Execute then
// TS.SaveToFile(SaveDialog1.FileName);
TS.SaveToFile(dfmfile);
finally
TS.Free;
temp.Free;
end;
end;
procedure TFmAutobs.toGetSc;
var
Sc,sc1,sc2,sc3,sc4,sc5:String;
S1,S2:String;
scPath:string;
begin
SS:=TStringList.Create;
try
Memo2.Lines.Clear;
Memo1.Lines.Clear;
SS.Clear;
begin
Sc:=‘autobs’;
ScPath:=Pathworkon+Sc;
ForceDirectories(ScPath);
begin
// sc1:=UpperCase(combobox1.Text);
// sc2:=UpperCase(combobox2.Text);
// sc3:=UpperCase(combobox3.Text);
// sc4:=UpperCase(combobox4.Text);
// sc5:=UpperCase(combobox5.Text);
sc1:=combobox1.Text;
sc2:=combobox2.Text;
sc3:=combobox3.Text;
sc4:=combobox4.Text;
sc5:=combobox5.Text;
if (sc2='') and (sc3='') and (sc4='') and (sc5='') then sc2:=sc1;
dfmfile:=scPath+'\uFm'+sc1+'.dfm';
//showmessage(dfmfile);
pasfile:=scPath+'\uFm'+sc1+'.pas';
S2:=sc+'\uFm'+sc1+'.pas';
S1:='uFm'+sc1+' in ' +quotedstr(s2)+' {Fm'+sc1+'},';
SS.Add(S1);
Memo1.Lines.Add(dfmfile);
Memo1.Lines.Add(pasfile);
Memo1.Lines.Add(S1);
toProcDfmTxtS(sc1,sc2,sc3,sc4,sc5);
toProcDfmPasS(sc1,sc2,sc3,sc4,dfmfile);
memo2.lines.LoadFromFile(dfmfile);
memo3.Lines.LoadFromFile(pasfile);
end;
end;
SS.SaveToFile(pathdprtxt);
Memo1.lines.Add(pathdprtxt);
finally
SS.Free;
end;
end;