?? report_public.pas
字號:
DialogUnits: TPoint;
ButtonTop, ButtonWidth, ButtonHeight: Integer;
begin
Result := False;
Form := TForm.Create(Application);
with Form do
try
Font.Name := '宋體';
Font.Size := 9;
DialogUnits := GetAveCharSize(Canvas);
BorderStyle := bsDialog;
Caption := ACaption;
ClientWidth := MulDiv(180, DialogUnits.X, 4);
ClientHeight := MulDiv(63, DialogUnits.Y, 8);
Position := poScreenCenter;
Prompt := TLabel.Create(Form);
with Prompt do
begin
Font.Name := '宋體';
Font.Size := 9;
Parent := Form;
AutoSize := True;
Left := MulDiv(8, DialogUnits.X, 4);
Top := MulDiv(8, DialogUnits.Y, 8);
Caption := APrompt;
end;
Edit := TEdit.Create(Form);
with Edit do
begin
Font.Name := '宋體';
Font.Size := 9;
Parent := Form;
Left := Prompt.Left;
Top := MulDiv(19, DialogUnits.Y, 8);
Width := MulDiv(164, DialogUnits.X, 4);
MaxLength := 255;
Text := Value;
SelectAll;
end;
ButtonTop := MulDiv(41, DialogUnits.Y, 8);
ButtonWidth := MulDiv(50, DialogUnits.X, 4);
ButtonHeight := MulDiv(14, DialogUnits.Y, 8);
with TButton.Create(Form) do
begin
Font.Name := '宋體';
Font.Size := 9;
Parent := Form;
Caption := '確定';
ModalResult := mrOk;
Default := True;
SetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth,
ButtonHeight);
end;
with TButton.Create(Form) do
begin
Font.Name := '宋體';
Font.Size := 9;
Parent := Form;
Caption := '取消';
ModalResult := mrCancel;
Cancel := True;
SetBounds(MulDiv(92, DialogUnits.X, 4), ButtonTop, ButtonWidth,
ButtonHeight);
end;
if ShowModal = mrOk then
begin
Value := Edit.Text;
Result := True;
end;
finally
Form.Free;
end;
end;
procedure TSReport.SRep_PrintOrPreview(Const Print0OrPreview1OrTxt2OrWord3OrHtml4 : integer;
DefaOrSelect : boolean);
begin
try
if PrintingOrPreview then Abort;
PrintingOrPreview := true;
screen.Cursor := crHourGlass;
try
EnaOrDisDataSource(false);
if Assigned(report_frm_report) Then
begin
Report_Frm_Report.free;
Report_Frm_Report := nil;
end;
Report_Frm_Report := TReport_frm_Report.Create(application);
with Report_Frm_Report do
begin
////////////////////////////////////////////////////////////////
SRep_UserFormName := FMy_UserFormName;
SRep_UserFormCaption := FMy_UserFormCaption;
SRep_SubDetailDataSet := FMy_SubDetailDataSet;
SRep_MainDataSetOne := FMy_MainDataSetOne;
SRep_MainDataSetTwo := FMy_MainDataSetTwo;
SRep_MainDataSetThree := FMy_MainDataSetThree;
SRep_MainDataSetFour := FMy_MainDataSetFour;
SRep_MainDataSetFive := FMy_MainDataSetFive;
SRep_ModelInfoFilesName := FMy_ModelInfoFilesName;
SRep_SaveDirectory := FMy_SaveDirectory;
SRep_PrintMemoRows := FMy_PrintMemoRows;
SRep_BottomMemoString := FMy_BottomMemoString;
////////////////////////////////////////////////////////////////
if DefaOrSelect then SRep_SelectMB := true else SRep_SelectMB := false;
if not CreatIniFileExecute then exit;
if (Print0OrPreview1OrTxt2OrWord3OrHtml4 = 0) Or
(Print0OrPreview1OrTxt2OrWord3OrHtml4 = 1) then
begin
Action_GetPageInfoExecute(nil);
Action_CreatDetail.OnExecute(nil);
Action_CreatHeadFootExecute(nil);
Action_CreatBigSmallTitleExecute(nil);
Action_CreatHeaderFooterExecute(nil);
Action_PageSizeIsReportExecute(nil);
Screen.Cursor := crDefault;
if Print0OrPreview1OrTxt2OrWord3OrHtml4 = 0 then
QuickRep.Print
else if Print0OrPreview1OrTxt2OrWord3OrHtml4 = 1 then
QuickRep.Preview;
end
else
begin
if Print0OrPreview1OrTxt2OrWord3OrHtml4 = 2 then
PrintToTxt
else if Print0OrPreview1OrTxt2OrWord3OrHtml4 = 3 then
PrintToExcel
else if Print0OrPreview1OrTxt2OrWord3OrHtml4 = 4 then
PrintToHtml;
end;
end;
finally
EnaOrDisDataSource(true);
Screen.Cursor := crDefault;
PrintingOrPreview := false;
end;
except
application.messagebox(pchar('您正在打印/預覽的報表發生錯誤。報表在發往 Windows 后臺時' + #13 +
'遇到技術困難,您需要重新設置您的打印機。或者需要對報表設' + #13 +
'置進行調整。(如:頁面大小、邊踞或字段寬度)。'),'WinStar通用報表工具',mb_ok + mb_iconinformation);
abort;
end;
end;
procedure TSReport.SRep_SettingOfVcl;
begin
try
try
screen.Cursor := crHourGlass;
if not Assigned(Report_Frm_Main) then
Report_Frm_Main := TReport_frm_Main.Create(application);
with Report_Frm_Main do
begin
////////////////////////////////////////////////////////////////
SRep_UserFormName := FMy_UserFormName;
SRep_userFormCaption_M := FMy_UserFormName; {當前認為窗口顯示和文件名是一樣的}
//SRep_userFormCaption_M := FMy_UserFormCaption;
SRep_SubDetailDataSet := FMy_SubDetailDataSet;
SRep_MainDataSetOne := FMy_MainDataSetOne;
SRep_MainDataSetTwo := FMy_MainDataSetTwo;
SRep_MainDataSetThree := FMy_MainDataSetThree;
SRep_MainDataSetFour := FMy_MainDataSetFour;
SRep_MainDataSetFive := FMy_MainDataSetFive;
SRep_ModelInfoFilesName := FMy_ModelInfoFilesName;
SRep_SaveDirectory := FMy_SaveDirectory;
SRep_MainDataSetOneCaption := FMy_MainDataSetOneCaption;
SRep_MainDataSetTwoCaption := FMy_MainDataSetTwoCaption;
SRep_MainDataSetThreeCaption := FMy_MainDataSetThreeCaption;
SRep_MainDataSetFourCaption := FMy_MainDataSetFourCaption;
SRep_MainDataSetFiveCaption := FMy_MainDataSetFiveCaption;
SRep_PrintMemoRows := FMy_PrintMemoRows;
SRep_BottomMemoString := FMy_BottomMemoString;
////////////////////////////////////////////////////////////////
ShowModal;
end;
finally
Screen.Cursor := crDefault;
end;
except
application.messagebox(pchar('您正在打印/預覽的報表發生錯誤。報表在發往 Windows 后臺時' + #13 +
'遇到技術困難,您需要重新設置您的打印機。或者需要對報表設' + #13 +
'置進行調整。(如:頁面大小、邊踞或字段寬度)。'),'WinStar通用報表工具',mb_ok + mb_iconinformation);
abort;
end;
end;
Procedure TSReport.EnaOrDisDataSource(const EnaOrdis : boolean);
begin
if not EnaOrDis then//切斷
begin
if not (FMy_SubDetailDataSet = nil) then
with FMy_SubDetailDataSet do
if not ControlsDisabled then DisableControls;
if not (FMy_MainDataSetOne = nil) then
with FMy_MainDataSetOne do
if not ControlsDisabled then DisableControls;
if not (FMy_MainDataSetTwo = nil) then
with FMy_MainDataSetTwo do
if not ControlsDisabled then DisableControls;
if not (FMy_MainDataSetThree = nil) then
with FMy_MainDataSetThree do
if not ControlsDisabled then DisableControls;
if not (FMy_MainDataSetFour = nil) then
with FMy_MainDataSetFour do
if not ControlsDisabled then DisableControls;
if not (FMy_MainDataSetFive = nil) then
with FMy_MainDataSetFive do
if not ControlsDisabled then DisableControls;
end
else
begin
if not (FMy_SubDetailDataSet = nil) then
while FMy_SubDetailDataSet.ControlsDisabled do
FMy_SubDetailDataSet.EnableControls;
if not (FMy_MainDataSetOne = nil) then
while FMy_MainDataSetOne.ControlsDisabled do
FMy_MainDataSetOne.EnableControls;
if not (FMy_MainDataSetTwo = nil) then
while FMy_MainDataSetTwo.ControlsDisabled do
FMy_MainDataSetTwo.EnableControls;
if not (FMy_MainDataSetThree = nil) then
while FMy_MainDataSetThree.ControlsDisabled do
FMy_MainDataSetThree.EnableControls;
if not (FMy_MainDataSetFour = nil) then
while FMy_MainDataSetFour.ControlsDisabled do
FMy_MainDataSetFour.EnableControls;
if not (FMy_MainDataSetFive = nil) then
while FMy_MainDataSetFive.ControlsDisabled do
FMy_MainDataSetFive.EnableControls;
end;
end;
procedure Register;
begin
RegisterComponents('SReport', [TSReport]);
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -