home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Delphi / TeeChartPro / TeeChart5Delphi5Eval.exe / %MAINDIR% / Examples / Features / Chart_MultiClipboard.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-09-10  |  1.8 KB  |  79 lines

  1. unit Chart_MultiClipboard;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Base, StdCtrls, Series, TeEngine, ExtCtrls, TeeProcs, Chart;
  8.  
  9. type
  10.   TChartMultiClipboard = class(TBaseForm)
  11.     Chart2: TChart;
  12.     Chart3: TChart;
  13.     Series1: TLineSeries;
  14.     Series2: TBarSeries;
  15.     Series3: TAreaSeries;
  16.     Button1: TButton;
  17.     procedure FormCreate(Sender: TObject);
  18.     procedure Button1Click(Sender: TObject);
  19.   private
  20.     { Private declarations }
  21.   public
  22.     { Public declarations }
  23.   end;
  24.  
  25. implementation
  26.  
  27. {$R *.DFM}
  28.  
  29. Uses Clipbrd;
  30.  
  31. procedure TChartMultiClipboard.FormCreate(Sender: TObject);
  32. begin
  33.   inherited;
  34.   Series1.FillSampleValues(6);
  35.   Series2.FillSampleValues(6);
  36.   Series3.FillSampleValues(26);
  37. end;
  38.  
  39. procedure TChartMultiClipboard.Button1Click(Sender: TObject);
  40. Var Bitmap : TBitmap;
  41.  
  42.    Procedure DrawChart(Chart:TChart; Const Rect:TRect);
  43.    begin
  44.      { disable using the internal "buffer" image... }
  45.      Chart.BufferedDisplay:=False;
  46.      try
  47.        { draw the chart to the bitmap at the "Rect" position... }
  48.        Chart.Draw(Bitmap.Canvas,Rect);
  49.      finally
  50.        { enable again the internal buffer image... }
  51.        Chart.BufferedDisplay:=True;
  52.      end;
  53.    end;
  54.  
  55. begin
  56.   { create a temporary bitmap image... }
  57.   Bitmap := TBitmap.Create;
  58.   try
  59.     { set the bitmap dimensions... }
  60.     Bitmap.Width:=500;
  61.     Bitmap.Height:=300;
  62.  
  63.     { draw the 3 charts... }
  64.     DrawChart(Chart1,Rect(251,0,500-1,125));
  65.     DrawChart(Chart2,Rect(0,0,250,125));
  66.     DrawChart(Chart3,Rect(0,126,500-1,300-1));
  67.  
  68.     { finally, copy the image to clipboard... }
  69.     Clipboard.Assign(Bitmap);
  70.   finally
  71.     { remove the temporary bitmap... }
  72.     Bitmap.Free;
  73.   end;
  74. end;
  75.  
  76. initialization
  77.   RegisterClass(TChartMultiClipboard);
  78. end.
  79.