⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 report_public.pas

📁 大学学生管理系统 一款比较好的学生管理系统 DELPHI+ACCE
💻 PAS
📖 第 1 页 / 共 2 页
字号:
  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 + -