//Lines为TStrings的procedure TStrings.Assign(Source: TPersistent); begin if Source is TStrings then begin BeginUpdate; try Clear; FDefined := TStrings(Source).FDefined; FNameValueSeparator := TStrings(Source).FNameValueSeparator; FQuoteChar := TStrings(Source).FQuoteChar; FDelimiter := TStrings(Source).FDelimiter; AddStrings(TStrings(Source)); finally EndUpdate; end; Exit; end; inherited Assign(Source); end;
eg1: procedure TMainInfo.RzGroup2Items0Click(Sender: TObject); begin if not Assigned(SzmxInfo_Frm) then SzmxInfo_Frm:=TSzmxInfo_Frm.Create(Self); SzmxInfo_Frm.Parent:=MainInfo.main_pnl; SzmxInfo_Frm.Align:=alClient; SzmxInfo_Frm.BorderIcons:=[]; SzmxInfo_Frm.Show; end;eg2: procedure TMainInfo.RzGroup3Items0Click(Sender: TObject); begin if not Assigned(SzmxInfo_Frm) then //SzmxInfo_Frm:=TSzmxInfo_Frm.Create(Self) MessageDlg('沒有報表可以預覽!'+#13#13+'請打開收支明細管理界面再進行報表預覽!!!',mtInformation,[mbOK],0) else SzmxInfo_Frm.OuttoReport; end;
还是问Assign呢 ?
begin
if Source is TStrings then
begin
BeginUpdate;
try
Clear;
FDefined := TStrings(Source).FDefined;
FNameValueSeparator := TStrings(Source).FNameValueSeparator;
FQuoteChar := TStrings(Source).FQuoteChar;
FDelimiter := TStrings(Source).FDelimiter;
AddStrings(TStrings(Source));
finally
EndUpdate;
end;
Exit;
end;
inherited Assign(Source);
end;
eg1:
procedure TMainInfo.RzGroup2Items0Click(Sender: TObject);
begin
if not Assigned(SzmxInfo_Frm) then
SzmxInfo_Frm:=TSzmxInfo_Frm.Create(Self);
SzmxInfo_Frm.Parent:=MainInfo.main_pnl;
SzmxInfo_Frm.Align:=alClient;
SzmxInfo_Frm.BorderIcons:=[];
SzmxInfo_Frm.Show;
end;eg2:
procedure TMainInfo.RzGroup3Items0Click(Sender: TObject);
begin
if not Assigned(SzmxInfo_Frm) then
//SzmxInfo_Frm:=TSzmxInfo_Frm.Create(Self)
MessageDlg('沒有報表可以預覽!'+#13#13+'請打開收支明細管理界面再進行報表預覽!!!',mtInformation,[mbOK],0)
else
SzmxInfo_Frm.OuttoReport;
end;