unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Printers, QComCtrls,Classes, Graphics, Controls, Forms,
  Dialogs, TeeEdit, TeEngine, Series, TeePolar, ExtCtrls, Chart, TeeProcs,
  TeePreviewPanel, StdCtrls, TeeSurfa, TeePoin3, TeeRose, TeeTools;

type
  TForm1 = class(TForm)
    TeePreviewPanel1: TTeePreviewPanel;
    Panel1: TPanel;
    Button1: TButton;
    Panel2: TPanel;
    Panel3: TPanel;
    Chart2: TChart;
    Chart3: TChart;
    Chart4: TChart;
    Series1: TPolarSeries;
    Series2: TRadarSeries;
    Series3: TClockSeries;
    Series4: TBubble3DSeries;
    Chart1: TChart;
    Label1: TLabel;
    ComboBox1: TComboBox;
    ChartPreviewer1: TChartPreviewer;
    ChartTool1: TAxisScrollTool;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Chart1Click(Sender: TObject);
    procedure Chart2Click(Sender: TObject);
    procedure Chart3Click(Sender: TObject);
    procedure Chart4Click(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure TeePreviewPanel1ChangeMargins(Sender: TObject;
      DisableProportional: Boolean; const NewMargins: TRect);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(50);
Series2.FillSampleValues(15);
Series3.FillSampleValues(3);
Series4.FillSampleValues(30);
//TeePreviewPanel1.PrintLandscape;    //横向poLandscape，风景方式； 竖向poPortrait人像方式
//TeePreviewPanel1.PrintOrientation(poLandscape);
TeePreviewPanel1.Orientation := ppoLandscape;
TeePreviewPanel1.Refresh;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
rc:TRect;
s:string;
begin
//ChartPreviewer1.Options ;
TeePreviewPanel1.PrintMargins := Rect(10,10,50,50);
TeePreviewPanel1.Panels.Add(Chart1);
{
TeePreviewPanel1.Panels.Items[0].Left := 5;
TeePreviewPanel1.Panels.Items[0].Top  := 5;
TeePreviewPanel1.Panels.Items[0].Width := 60;
TeePreviewPanel1.Panels.Items[0].Height := 60;
}
//TeePreviewPanel1.Panels.Items[0].Refresh;
//TeePreviewPanel1.Panels.Add(Chart2);
//TeePreviewPanel1.Panels.Items[1].Left := 10;
//TeePreviewPanel1.Panels.Items[1].Top  := 10;
//TeePreviewPanel1.Panels.Items[1].Width := 5;
//TeePreviewPanel1.Panels.Items[1].Height := 5;

TeePreviewPanel1.Refresh;

{
TeePreviewPanel1.PrintMargins := Rect(50,50,10,10);
TeePreviewPanel1.Panels.Add(Chart2);
rc := TeePreviewPanel1.PrintMargins;
s:= 'left= '+Inttostr(rc.Left)+#13#10+
    'top= '+Inttostr(rc.top)+#13#10+
    'right= '+Inttostr(rc.right)+#13#10+
    'bottom= '+Inttostr(rc.bottom);
showmessage(s);
//TeePreviewPanel1.Panels.Add(Chart3);
//TeePreviewPanel1.Panels.Add(Chart4);
}
end;

procedure TForm1.Chart1Click(Sender: TObject);
begin
TeePreviewPanel1.Panels.Add(Chart1);
TeePreviewPanel1.Panel.Refresh;
TeePreviewPanel1.Refresh;
end;

procedure TForm1.Chart2Click(Sender: TObject);
begin
TeePreviewPanel1.Panels.Add(Chart2);
TeePreviewPanel1.Panel.Refresh;
TeePreviewPanel1.Refresh;
end;

procedure TForm1.Chart3Click(Sender: TObject);
begin
TeePreviewPanel1.Panels.Add(Chart3);
TeePreviewPanel1.Panel.Refresh;
TeePreviewPanel1.Refresh;
end;

procedure TForm1.Chart4Click(Sender: TObject);
begin
TeePreviewPanel1.Panels.Add(Chart4);
TeePreviewPanel1.Panel.Refresh;
TeePreviewPanel1.Refresh;
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
case ComboBox1.ItemIndex of
//0: TeePreviewPanel1.PrintOrientation(poLandscape);   //poLandscape;    //横向，风景模式
//1: TeePreviewPanel1.PrintOrientation(poPortrait);    //hoVertical       //竖向， 人像模式
0: TeePreviewPanel1.Orientation := ppoLandscape;   //poLandscape;    //横向，风景模式
1: TeePreviewPanel1.Orientation := ppoPortrait;    //hoVertical       //竖向， 人像模式
end;
TeePreviewPanel1.Refresh;
end;

procedure TForm1.TeePreviewPanel1ChangeMargins(Sender: TObject;
  DisableProportional: Boolean; const NewMargins: TRect);
begin
TeePreviewPanel1.PrintMargins := NewMargins;
end;

end.
