home *** CD-ROM | disk | FTP | other *** search
- {*********************************************}
- { TeeChart Delphi Component Library }
- { Gradient Styles Demo }
- { Copyright (c) 1995-1998 by David Berneda }
- { All rights reserved }
- {*********************************************}
- unit UGradien;
-
- interface
-
- uses
- WinProcs,WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- Series, TeEngine, TeeProcs, Chart, StdCtrls, ExtCtrls;
-
- type
- TGradientForm = class(TForm)
- Panel1: TPanel;
- Memo1: TMemo;
- Button1: TButton;
- Chart1: TChart;
- Series1: TLineSeries;
- Series2: TBarSeries;
- Label1: TLabel;
- ComboBox1: TComboBox;
- Label2: TLabel;
- Shape1: TShape;
- Shape2: TShape;
- Label3: TLabel;
- Button2: TButton;
- procedure Button1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure ComboBox1Change(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Shape1MouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure Shape2MouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- implementation
-
- {$R *.DFM}
-
- { This unit (TeCanvas) is necessary to use the gradient constants }
- Uses TeCanvas,PenDlg;
-
- procedure TGradientForm.Button1Click(Sender: TObject);
- begin
- Close;
- end;
-
- procedure TGradientForm.FormCreate(Sender: TObject);
- begin
- Series1.FillSampleValues(30);
- Series2.FillSampleValues(6);
-
-
- { Set initial values for this demo controls }
- ComboBox1.ItemIndex:=6;
- Shape1.Cursor:=crTeeHand;
- Shape2.Cursor:=crTeeHand;
- Shape1.Brush.Color:=Chart1.Gradient.StartColor;
- Shape2.Brush.Color:=Chart1.Gradient.EndColor;
- end;
-
- procedure TGradientForm.ComboBox1Change(Sender: TObject);
- begin
- { change the gradient style direction }
- Chart1.Gradient.Direction:=TGradientDirection(ComboBox1.ItemIndex);
- end;
-
- procedure TGradientForm.Button2Click(Sender: TObject);
- var tmp:TColor;
- begin
- { exchange the Start and End colors }
- With Chart1.Gradient do
- begin
- tmp:=StartColor;
- StartColor:=EndColor;
- EndColor:=tmp;
- end;
- end;
-
- procedure TGradientForm.Shape1MouseUp(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- with Chart1.Gradient do
- begin
- StartColor:=EditColor(Self,StartColor);
- Shape1.Brush.Color:=StartColor;
- end;
- end;
-
- procedure TGradientForm.Shape2MouseUp(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- with Chart1.Gradient do
- begin
- EndColor:=EditColor(Self,EndColor);
- Shape2.Brush.Color:=EndColor;
- end;
- end;
-
- end.
-