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

📄 bargraph.pas

📁 suite component ace report
💻 PAS
字号:
unit Bargraph;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, sctctrl, Sctvar, Sctrep, StdCtrls, ExtCtrls, Grids,
  DBGrids, DB, DBTables, Buttons, Sctbtn, AcePage;

type
  TBarGraphForm = class(TForm)
    CountrySource: TDataSource;
    CountryTable: TTable;
    DBGrid1: TDBGrid;
    ReportHeaderBand: TSctBand;
    ReportHeaderBandlevel: TSctLevel;
    PageHeaderBand: TSctBand;
    PageHeaderBandlevel: TSctLevel;
    DetailBand: TSctBand;
    DetailBandlevel: TSctLevel;
    PageFooterBand: TSctBand;
    PageFooterBandlevel: TSctLevel;
    ReportFooterBand: TSctBand;
    ReportFooterBandlevel: TSctLevel;
    ReportPage: TSctGrouppage;
    SctReport1: TSctReport;
    svarDateTime: TSctDateTimeVar;
    svarPage: TSctPageVar;
    DataSourceGuide: TSctDataSourceGuide;
    countrytableNAME: TSctdbvar;
    countrytableCAPITAL: TSctdbvar;
    countrytableCONTINENT: TSctdbvar;
    countrytableAREA: TSctdbvar;
    countrytablePOPULATION: TSctdbvar;
    TSctvarlabel: TSctvarlabel;
    TSctTextLabel: TSctTextLabel;
    TSctTextLabel1: TSctTextLabel;
    TSctTextLabel2: TSctTextLabel;
    SctVerticalDivider1: TSctVerticalDivider;
    SctVerticalDivider2: TSctVerticalDivider;
    SctVerticalDivider3: TSctVerticalDivider;
    SctReportButton1: TSctReportButton;
    SctVerticalDivider4: TSctVerticalDivider;
    SctVerticalDivider5: TSctVerticalDivider;
    SctVerticalDivider6: TSctVerticalDivider;
    SctTextLabel1: TSctTextLabel;
    SctTextLabel2: TSctTextLabel;
    SctTextLabel3: TSctTextLabel;
    SctVerticalDivider7: TSctVerticalDivider;
    SctTextLabel4: TSctTextLabel;
    SctVerticalDivider8: TSctVerticalDivider;
    SctTextLabel5: TSctTextLabel;
    SctTextLabel6: TSctTextLabel;
    SctTextLabel7: TSctTextLabel;
    SctVerticalDivider9: TSctVerticalDivider;
    SctTextLabel8: TSctTextLabel;
    SctVerticalDivider10: TSctVerticalDivider;
    SctTextLabel9: TSctTextLabel;
    SctVerticalDivider11: TSctVerticalDivider;
    SctTextLabel10: TSctTextLabel;
    SctVerticalDivider12: TSctVerticalDivider;
    SctVerticalDivider13: TSctVerticalDivider;
    SctTextLabel11: TSctTextLabel;
    SctTextLabel12: TSctTextLabel;
    SctVerticalDivider14: TSctVerticalDivider;
    SctLine1: TSctLine;
    AreaLabel: TSctTextLabel;
    PopulationLabel: TSctTextLabel;
    CountryTableName2: TStringField;
    CountryTableCapital2: TStringField;
    CountryTableContinent2: TStringField;
    CountryTableArea2: TFloatField;
    CountryTablePopulation2: TFloatField;
    Button1: TButton;
    procedure AreaBarBeforePrint(lb: TSctLabel);
    procedure SctTextLabel6LabelPrintWhen(lb: TSctLabel; var Result: Boolean);
    procedure SctTextLabel7LabelPrintWhen(lb: TSctLabel; var Result: Boolean);
    procedure PopulationBarBeforePrint(lb: TSctLabel);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  BarGraphForm: TBarGraphForm;

implementation

{$R *.DFM}

procedure TBarGraphForm.AreaBarBeforePrint(lb: TSctLabel);
begin
  AreaLabel.Width := round((CountryTable.FieldByName('AREA').AsFloat / 12000000)
                          * 270);
  if AreaLabel.Width > 270 then AreaLabel.Width := 270;
end;

procedure TBarGraphForm.SctTextLabel6LabelPrintWhen(lb: TSctLabel; var Result: Boolean);
begin
  result := CountryTable.FieldByName('AREA').AsInteger > 12000000;
end;

procedure TBarGraphForm.SctTextLabel7LabelPrintWhen(lb: TSctLabel; var Result: Boolean);
begin
  result := CountryTable.FieldByName('POPULATION').AsInteger > 100000000;
end;

procedure TBarGraphForm.PopulationBarBeforePrint(lb: TSctLabel);
begin
  PopulationLabel.Width := round((CountryTable.FieldByName('POPULATION').AsFloat
                                / 100000000) * 270);
  if PopulationLabel.Width > 270 then PopulationLabel.Width := 270;
end;

procedure TBarGraphForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;

procedure TBarGraphForm.Button1Click(Sender: TObject);
begin
  Close;
end;

end.

⌨️ 快捷键说明

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