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

📄 reporteditors.pas

📁 该控件是一个带表格线的打印构件
💻 PAS
字号:
{-------------------------------------------------------------------------------
  ReportPage Component Trial Version(c)
  Designed for Delphi 4.0

  REPORT EDITORS unit

  please visit my site: http://lixinhua.yeah.net
                        http://reportpage.yeah.net
          my E-Mail is: lixinhua@163.net
                Author: Xinhua.LEE
--------------------------------------------------------------------------------}

unit ReportEditors;

interface

uses
  DsgnIntf, Forms, ReportUnit, ReportLineEdit, ReportPreview, ReportAbout;

type
  TReportSourceEditor = class;
  TReportLineProperty = class;
  TReportSingleEditor = class;

  TReportSourceEditor = class(TComponentEditor)
  public
    function GetVerbCount: Integer; override;
    function GetVerb(Index: Integer): string; override;
    procedure ExecuteVerb(Index: Integer); override;
  end;

  TReportLineProperty = class(TClassProperty)
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
  end;

  TReportSingleEditor = class(TComponentEditor)
  public
    function GetVerbCount: Integer; override;
    function GetVerb(Index: Integer): string; override;
    procedure ExecuteVerb(Index: Integer); override;
  end;

implementation

function TReportSourceEditor.GetVerbCount: Integer;
begin
  Result := 1;
end;

function TReportSourceEditor.GetVerb(Index: Integer): string;
begin
  if Index = 0 then Result := 'Abo&ut ReportPage Component';
end;

procedure TReportSourceEditor.ExecuteVerb(Index: Integer);
begin
  if Index = 0 then
  begin
    AboutForm := TAboutForm.Create(Application);
    try
      AboutForm.ShowModal;
    finally
      AboutForm.Free;
    end;
  end;
end;

procedure TReportLineProperty.Edit;
begin
  ReportLineEditForm := TReportLineEditForm.Create(Application);
  try
    ReportLineEditForm.ReportLine := TReportLine(GetOrdValue);
    ReportLineEditForm.ShowModal;
    if ReportLineEditForm.Modified then Designer.Modified;
  finally
    ReportLineEditForm.Free;
  end;
end;

function TReportLineProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paSubProperties];
end;

function TReportSingleEditor.GetVerbCount: Integer;
begin
  Result := 2;
end;

function TReportSingleEditor.GetVerb(Index: Integer): string;
begin
  case Index of
    0: Result := '&Preview';
    1: Result := 'Abo&ut Report Page Component';
  end;
end;

procedure TReportSingleEditor.ExecuteVerb(Index: Integer);
begin
  case Index of
    0: if TReportSingle(Component).Linked then
       begin
         PreviewForm := TPreviewForm.Create(Application);
         try
           PreviewForm.ReportSingle := TReportSingle(Component);
           PreviewForm.ShowModal;
         finally
           PreviewForm.Free;
         end;
       end;
    1: begin
         AboutForm := TAboutForm.Create(Application);
         try
           AboutForm.ShowModal;
         finally
           AboutForm.Free;
         end;
       end;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -