home *** CD-ROM | disk | FTP | other *** search
- {*********************************************}
- { TeeChart Delphi Component Library }
- { Print Previewer component Demo }
- { Copyright (c) 1995-1998 by David Berneda }
- { All rights reserved }
- {*********************************************}
- unit UChaPre;
-
- interface
-
- uses
- WinProcs,WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- Buttons, StdCtrls, ExtCtrls, TeEngine, TeeSurfa, TeeEdit, TeeProcs, Chart;
-
- type
- TChartPreviewForm = class(TForm)
- Panel1: TPanel;
- Memo1: TMemo;
- Button1: TButton;
- BShow: TBitBtn;
- Chart1: TChart;
- Panel2: TPanel;
- ChartPreviewer1: TChartPreviewer;
- Label1: TLabel;
- Shape1: TShape;
- Label2: TLabel;
- CBWindowStyle: TComboBox;
- Series1: TSurfaceSeries;
- Edit1: TEdit;
- Label3: TLabel;
- GroupBox1: TGroupBox;
- CBPrinter: TCheckBox;
- CBSetup: TCheckBox;
- CBResize: TCheckBox;
- CBMove: TCheckBox;
- CBDetail: TCheckBox;
- CBOrient: TCheckBox;
- CBMargins: TCheckBox;
- CBPropor: TCheckBox;
- CBDrag: TCheckBox;
- CBPanel: TCheckBox;
- CBBitmap: TCheckBox;
- procedure FormCreate(Sender: TObject);
- procedure Shape1MouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure Edit1Change(Sender: TObject);
- procedure CBWindowStyleChange(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- procedure BShowClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- implementation
-
- {$R *.DFM}
- Uses PenDlg;
-
- procedure TChartPreviewForm.FormCreate(Sender: TObject);
- begin
- CBWindowStyle.ItemIndex:=0;
- Shape1.Cursor:=crTeeHand;
-
- Series1.FillSampleValues(10);
- end;
-
- procedure TChartPreviewForm.Shape1MouseUp(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- With ChartPreviewer1 do
- begin
- PaperColor:=EditColor(Self,PaperColor);
- Shape1.Brush.Color:=PaperColor;
- end;
- end;
-
- procedure TChartPreviewForm.Edit1Change(Sender: TObject);
- begin
- ChartPreviewer1.Title:=Edit1.Text;
- end;
-
- procedure TChartPreviewForm.CBWindowStyleChange(Sender: TObject);
- begin
- Case CBWindowStyle.ItemIndex of
- 0: ChartPreviewer1.WindowState:=wsNormal;
- 1: ChartPreviewer1.WindowState:=wsMaximized;
- 2: ChartPreviewer1.WindowState:=wsMinimized;
- end;
- end;
-
- procedure TChartPreviewForm.Button1Click(Sender: TObject);
- begin
- Close;
- end;
-
- procedure TChartPreviewForm.BShowClick(Sender: TObject);
- begin
- { Set the different Options depending on the check boxes }
- With ChartPreviewer1 do
- begin
- Options:=[];
- if CBPrinter.Checked then Options:=Options +[cpoChangePrinter];
- if CBSetup.Checked then Options:=Options +[cpoSetupPrinter];
- if CBResize.Checked then Options:=Options +[cpoResizeChart];
- if CBPanel.Checked then Options:=Options +[cpoPrintPanel];
- if CBMove.Checked then Options:=Options +[cpoMoveChart];
- if CBDetail.Checked then Options:=Options +[cpoChangeDetail];
- if CBOrient.Checked then Options:=Options +[cpoChangePaperOrientation];
- if CBMargins.Checked then Options:=Options +[cpoChangeMargins];
- if CBBitmap.Checked then Options:=Options +[cpoAsBitmap];
- if CBDrag.Checked then Options:=Options +[cpoDragChart];
- if CBPropor.Checked then Options:=Options +[cpoProportional];
-
- { Show the Preview !! }
- Execute;
- end;
- end;
-
- end.
-