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

📄 rm_pchart.pas

📁 这是一个功能强大
💻 PAS
字号:
unit RM_PChart;

interface

{$I RM.inc}

{$IFDEF TeeChart}
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, TeeProcs, TeEngine, Chart, Series, DbChart,
  RM_Class, RM_Chart, RM_DBChart, RM_FormReport;

type
  TRMPrintChart = class(TComponent) // fake component
  end;

 { TRMFormPrintChart }
  TRMFormPrintChart = class(TRMFormReportObject)
  public
    procedure OnGenerate_Object(aFormReport: TRMFormReport; aPage: TRMReportPage;
      aControl: TControl; var t: TRMView); override;
  end;

  TRMFormPrintDBChart = class(TRMFormReportObject)
  public
    procedure OnGenerate_Object(aFormReport: TRMFormReport; aPage: TRMReportPage;
      aControl: TControl; var t: TRMView); override;
  end;

{$ENDIF}

implementation

{$IFDEF TeeChart}
uses RM_Common, RM_Utils;

type
  THackFormReport = class(TRMFormReport)
  end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TRMFormPrintChart }

procedure TRMFormPrintChart.OnGenerate_Object(aFormReport: TRMFormReport;
  aPage: TRMReportPage; aControl: TControl; var t: TRMView);
begin
  t := RMCreateObject(rmgtAddin, 'TRMChartView');
  t.ParentPage := aPage;
  t.spLeft := aControl.Left + THackFormReport(aFormReport).OffsX;
  t.spTop := aControl.Top + THackFormReport(aFormReport).OffsY;
  t.spWidth := aControl.Width + 4;
  t.spHeight := aControl.Height + 4;
  TRMChartView(t).AssignChart(TCustomChart(aControl));
  if rmgoDrawBorder in aFormReport.ReportOptions then
  begin
    t.LeftFrame.Visible := True;
    t.TopFrame.Visible := True;
    t.RightFrame.Visible := True;
    t.BottomFrame.Visible := True;
  end
  else
  begin
    t.LeftFrame.Visible := False;
    t.TopFrame.Visible := False;
    t.RightFrame.Visible := False;
    t.BottomFrame.Visible := False;
  end;

  if aFormReport.DrawOnPageFooter then
    aFormReport.ColumnFooterViews.Add(t)
  else
    aFormReport.ColumnHeaderViews.Add(t);
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TRMFormPrintDBChart }

procedure TRMFormPrintDBChart.OnGenerate_Object(aFormReport: TRMFormReport;
  aPage: TRMReportPage; aControl: TControl; var t: TRMView);
begin
  t := RMCreateObject(rmgtAddin, 'TRMDBChartView');
  t.ParentPage := aPage;
  t.spLeft := aControl.Left + THackFormReport(aFormReport).OffsX;
  t.spTop := aControl.Top + THackFormReport(aFormReport).OffsY;
  t.spWidth := aControl.Width + 4;
  t.spHeight := aControl.Height + 4;
  TRMDBChartView(t).AssignChart(TCustomChart(aControl));
  if rmgoDrawBorder in aFormReport.ReportOptions then
  begin
    t.LeftFrame.Visible := True;
    t.TopFrame.Visible := True;
    t.RightFrame.Visible := True;
    t.BottomFrame.Visible := True;
  end
  else
  begin
    t.LeftFrame.Visible := False;
    t.TopFrame.Visible := False;
    t.RightFrame.Visible := False;
    t.BottomFrame.Visible := False;
  end;

  if aFormReport.DrawOnPageFooter then
    aFormReport.ColumnFooterViews.Add(t)
  else
    aFormReport.ColumnHeaderViews.Add(t);
end;

initialization
  RMRegisterFormReportControl(TCustomChart, TRMFormPrintChart);
  RMRegisterFormReportControl(TDBChart, TRMFormPrintDBChart);
{$ENDIF}
end.

⌨️ 快捷键说明

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