Преглед изворни кода

报表界面,窗口显示控制,最大化按钮消失,窗口最大化,且不遮住下部任务栏;

MaiXinRong пре 9 година
родитељ
комит
2fad2d41e1
3 измењених фајлова са 40 додато и 26 уклоњено
  1. 12 13
      Forms/ReportsFrm.dfm
  2. 9 3
      Forms/ReportsFrm.pas
  3. 19 10
      Units/UtilMethods.pas

+ 12 - 13
Forms/ReportsFrm.dfm

@@ -14,8 +14,7 @@ object ReportsForm: TReportsForm
   Font.Name = #23435#20307
   Font.Name = #23435#20307
   Font.Style = []
   Font.Style = []
   OldCreateOrder = False
   OldCreateOrder = False
-  Position = poDefault
-  WindowState = wsMaximized
+  Position = poMainFormCenter
   PixelsPerInch = 96
   PixelsPerInch = 96
   TextHeight = 12
   TextHeight = 12
   object pnlPaperSize: TPanel
   object pnlPaperSize: TPanel
@@ -61,7 +60,7 @@ object ReportsForm: TReportsForm
     Width = 223
     Width = 223
     Height = 25
     Height = 25
     BevelInner = bvLowered
     BevelInner = bvLowered
-    TabOrder = 3
+    TabOrder = 1
     object chkExcelMode: TCheckBox
     object chkExcelMode: TCheckBox
       Left = 6
       Left = 6
       Top = 4
       Top = 4
@@ -83,23 +82,23 @@ object ReportsForm: TReportsForm
   end
   end
   object pnlReports: TPanel
   object pnlReports: TPanel
     Left = 0
     Left = 0
-    Top = 81
+    Top = 76
     Width = 1107
     Width = 1107
-    Height = 425
+    Height = 430
     Align = alClient
     Align = alClient
     BevelOuter = bvNone
     BevelOuter = bvNone
     TabOrder = 6
     TabOrder = 6
     object sprReportPreview: TSplitter
     object sprReportPreview: TSplitter
       Left = 211
       Left = 211
       Top = 0
       Top = 0
-      Height = 425
+      Height = 430
       AutoSnap = False
       AutoSnap = False
     end
     end
     object pnlReportsList: TPanel
     object pnlReportsList: TPanel
       Left = 0
       Left = 0
       Top = 0
       Top = 0
       Width = 211
       Width = 211
-      Height = 425
+      Height = 430
       Align = alLeft
       Align = alLeft
       BevelOuter = bvNone
       BevelOuter = bvNone
       TabOrder = 0
       TabOrder = 0
@@ -107,7 +106,7 @@ object ReportsForm: TReportsForm
         Left = 0
         Left = 0
         Top = 35
         Top = 35
         Width = 211
         Width = 211
-        Height = 390
+        Height = 395
         Align = alClient
         Align = alClient
         Font.Charset = DEFAULT_CHARSET
         Font.Charset = DEFAULT_CHARSET
         Font.Color = clWindowText
         Font.Color = clWindowText
@@ -194,7 +193,7 @@ object ReportsForm: TReportsForm
       Left = 214
       Left = 214
       Top = 0
       Top = 0
       Width = 893
       Width = 893
-      Height = 425
+      Height = 430
       HorzScrollBar.Increment = 48
       HorzScrollBar.Increment = 48
       HorzScrollBar.Tracking = True
       HorzScrollBar.Tracking = True
       VertScrollBar.Increment = 32
       VertScrollBar.Increment = 32
@@ -217,7 +216,7 @@ object ReportsForm: TReportsForm
     Font.Charset = DEFAULT_CHARSET
     Font.Charset = DEFAULT_CHARSET
     Font.Color = clWindowText
     Font.Color = clWindowText
     Font.Height = -12
     Font.Height = -12
-    Font.Name = #24494#36719#38597#40657
+    Font.Name = #23435#20307
     Font.Style = []
     Font.Style = []
     Bars = <
     Bars = <
       item
       item
@@ -314,7 +313,7 @@ object ReportsForm: TReportsForm
         Caption = #33539#22260#36755#20986
         Caption = #33539#22260#36755#20986
         DockedDockingStyle = dsTop
         DockedDockingStyle = dsTop
         DockedLeft = 0
         DockedLeft = 0
-        DockedTop = 52
+        DockedTop = 47
         DockingStyle = dsTop
         DockingStyle = dsTop
         FloatLeft = 602
         FloatLeft = 602
         FloatTop = 414
         FloatTop = 414
@@ -344,7 +343,7 @@ object ReportsForm: TReportsForm
         Caption = #25253#34920#36873#39033
         Caption = #25253#34920#36873#39033
         DockedDockingStyle = dsTop
         DockedDockingStyle = dsTop
         DockedLeft = 308
         DockedLeft = 308
-        DockedTop = 52
+        DockedTop = 47
         DockingStyle = dsTop
         DockingStyle = dsTop
         FloatLeft = 484
         FloatLeft = 484
         FloatTop = 279
         FloatTop = 279
@@ -389,7 +388,7 @@ object ReportsForm: TReportsForm
     DockControlHeights = (
     DockControlHeights = (
       0
       0
       0
       0
-      81
+      76
       0)
       0)
     object xlbPrint: TdxBarLargeButton
     object xlbPrint: TdxBarLargeButton
       Caption = #25171#21360
       Caption = #25171#21360

+ 9 - 3
Forms/ReportsFrm.pas

@@ -98,6 +98,8 @@ type
     FbNormal : Boolean;
     FbNormal : Boolean;
     FDisplayCount: Integer;
     FDisplayCount: Integer;
 
 
+    FLockForm: Boolean;
+
     procedure InitPageSettings;
     procedure InitPageSettings;
     procedure InitFont;
     procedure InitFont;
     procedure InitPaperSettings;
     procedure InitPaperSettings;
@@ -156,6 +158,8 @@ type
     property PageCount: Integer read GetPageCount;
     property PageCount: Integer read GetPageCount;
     property ExcelMode: TOutputExcelMode read GetExcelMode;
     property ExcelMode: TOutputExcelMode read GetExcelMode;
     property IsExcel2010: Boolean read GetIsExcel2010;
     property IsExcel2010: Boolean read GetIsExcel2010;
+
+    property LockForm: Boolean read FLockForm write FLockForm;
   end;
   end;
 
 
   procedure DisplayReportsForm(AProjectData: TProjectData);
   procedure DisplayReportsForm(AProjectData: TProjectData);
@@ -164,7 +168,7 @@ implementation
 
 
 uses
 uses
   UtilMethods, Math, DirectPrintUnit, Globals, ZhAPI, ReportAdjustFrm,
   UtilMethods, Math, DirectPrintUnit, Globals, ZhAPI, ReportAdjustFrm,
-  Contnrs, mEncryptUnit, Printers, WinSpool;
+  Contnrs, mEncryptUnit, Printers, WinSpool, MainFrm;
 
 
 {$R *.dfm}
 {$R *.dfm}
 
 
@@ -173,6 +177,8 @@ var
   ReportsForm: TReportsForm;
   ReportsForm: TReportsForm;
 begin
 begin
   ReportsForm := TReportsForm.Create(nil);
   ReportsForm := TReportsForm.Create(nil);
+  {ReportsForm.BorderIcons := ReportsForm.BorderIcons - [biMaximize];
+  ReportsForm.WindowState := wsMaximized;}
   ReportsForm.ProjectData := AProjectData;
   ReportsForm.ProjectData := AProjectData;
   ReportsForm.InitReportSettings;
   ReportsForm.InitReportSettings;
   ReportsForm.InitFormView;
   ReportsForm.InitFormView;
@@ -659,7 +665,7 @@ begin
       AddReportTemplate(vTemplateNode);
       AddReportTemplate(vTemplateNode);
     end
     end
     else
     else
-      if QuestMessage('已存在报表模板' + ExtractFileName(sFileName) + ',是否覆盖原模板?') then
+      if QuestMessage('已存在报表模板' + ExtractFileName(sFileName) + ',是否覆盖原模板?', Handle) then
         CopyFile(PChar(sFileName), PChar(sNewFileName), False)
         CopyFile(PChar(sFileName), PChar(sNewFileName), False)
       else
       else
         Exit;
         Exit;
@@ -690,7 +696,7 @@ begin
   sFileName := vTemplateNode.TemplateName;
   sFileName := vTemplateNode.TemplateName;
   if SaveFile(sFileName, '.srt') then
   if SaveFile(sFileName, '.srt') then
   begin
   begin
-    if not FileExists(sFileName) or QuestMessage('存在同名文件,是否覆盖?') then
+    if not FileExists(sFileName) or QuestMessage('存在同名文件,是否覆盖?', Handle) then
       CopyFile(PChar(vTemplateNode.FileName), PChar(sFileName), False);
       CopyFile(PChar(vTemplateNode.FileName), PChar(sFileName), False);
   end;
   end;
 end;
 end;

+ 19 - 10
Units/UtilMethods.pas

@@ -23,10 +23,10 @@ type
   function GetsdDataSetNewID(ADataSet: TsdDataSet; const AIndex: string): Integer;
   function GetsdDataSetNewID(ADataSet: TsdDataSet; const AIndex: string): Integer;
 
 
   {Message}
   {Message}
-  procedure WarningMessage(const AMsg: string);
+  procedure WarningMessage(const AMsg: string; AHandle: THandle = 0);
   procedure ErrorMessage(const AMsg: string);
   procedure ErrorMessage(const AMsg: string);
-  function QuestMessage(const AMsg: string): Boolean;
-  function QuestMessageYesNo(const AMsg: string): Boolean;
+  function QuestMessage(const AMsg: string; AHandle: THandle = 0): Boolean;
+  function QuestMessageYesNo(const AMsg: string; AHandle: THandle = 0): Boolean;
   procedure TipMessage(const AMsg: string);
   procedure TipMessage(const AMsg: string);
   procedure DataSetErrorMessage(var Allow: Boolean; const AMsg: string);
   procedure DataSetErrorMessage(var Allow: Boolean; const AMsg: string);
 
 
@@ -181,9 +181,12 @@ begin
 end;
 end;
 
 
 {Message}
 {Message}
-procedure WarningMessage(const AMsg: string);
+procedure WarningMessage(const AMsg: string; AHandle: THandle = 0);
 begin
 begin
-   MessageBox(Application.Handle, PChar(AMsg), PChar('¾¯¸æ'), MB_OK or MB_ICONWARNING);
+  if AHandle = 0 then
+    MessageBox(Application.Handle, PChar(AMsg), PChar('¾¯¸æ'), MB_OK or MB_ICONWARNING)
+  else
+    MessageBox(AHandle, PChar(AMsg), PChar('¾¯¸æ'), MB_OK or MB_ICONWARNING);
 end;
 end;
 
 
 procedure ErrorMessage(const AMsg: string);
 procedure ErrorMessage(const AMsg: string);
@@ -191,14 +194,20 @@ begin
   MessageBox(Application.Handle, PChar(AMsg), PChar('´íÎó'), MB_OK or MB_ICONERROR);
   MessageBox(Application.Handle, PChar(AMsg), PChar('´íÎó'), MB_OK or MB_ICONERROR);
 end;
 end;
 
 
-function QuestMessage(const AMsg: string): Boolean;
+function QuestMessage(const AMsg: string; AHandle: THandle = 0): Boolean;
 begin
 begin
-  Result := MessageBox(Application.Handle, PChar(AMsg), PChar('ѯÎÊ'), MB_OKCANCEL or MB_ICONQUESTION) = IDOK;
+  if AHandle = 0 then
+    Result := MessageBox(Application.Handle, PChar(AMsg), PChar('ѯÎÊ'), MB_OKCANCEL or MB_ICONQUESTION) = IDOK
+  else
+    Result := MessageBox(AHandle, PChar(AMsg), PChar('ѯÎÊ'), MB_OKCANCEL or MB_ICONQUESTION) = IDOK;
 end;
 end;
 
 
-function QuestMessageYesNo(const AMsg: string): Boolean;
-begin
-  Result := MessageBox(Application.Handle, PChar(AMsg), PChar('ѯÎÊ'), MB_YESNO or MB_ICONQUESTION) = IDYes;
+function QuestMessageYesNo(const AMsg: string; AHandle: THandle = 0): Boolean;
+begin 
+  if AHandle = 0 then
+    Result := MessageBox(Application.Handle, PChar(AMsg), PChar('ѯÎÊ'), MB_YESNO or MB_ICONQUESTION) = IDYes
+  else
+    Result := MessageBox(AHandle, PChar(AMsg), PChar('ѯÎÊ'), MB_YESNO or MB_ICONQUESTION) = IDYes;
 end;
 end;
 
 
 procedure TipMessage(const AMsg: string);
 procedure TipMessage(const AMsg: string);